diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 65cb3df785f..63a4185a8bb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11834,10 +11834,6 @@ namespace ts { return; } - function isSuperCallExpression(n: Node): boolean { - return n.kind === SyntaxKind.CallExpression && (n).expression.kind === SyntaxKind.SuperKeyword; - } - function containsSuperCallAsComputedPropertyName(n: Declaration): boolean { return n.name && containsSuperCall(n.name); } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index aba0c883aaa..52ee502b25f 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -4895,18 +4895,24 @@ const _super = (function (geti, seti) { emitToken(SyntaxKind.CloseBraceToken, body.statements.end); } - function findInitialSuperCall(ctor: ConstructorDeclaration): ExpressionStatement { - if (ctor.body) { - const statement = (ctor.body).statements[0]; - if (statement && statement.kind === SyntaxKind.ExpressionStatement) { - const expr = (statement).expression; - if (expr && expr.kind === SyntaxKind.CallExpression) { - const func = (expr).expression; - if (func && func.kind === SyntaxKind.SuperKeyword) { - return statement; - } - } - } + /** + * Return the statement at a given index if it is a super-call statement + * @param ctor a constructor declaration + * @param index an index to constructor's body to check + */ + function getSuperCallAtGivenIndex(ctor: ConstructorDeclaration, index: number): ExpressionStatement { + if (!ctor.body) { + return undefined; + } + const statements = ctor.body.statements; + + if (!statements || index >= statements.length) { + return undefined; + } + + const statement = statements[index]; + if (statement.kind === SyntaxKind.ExpressionStatement) { + return isSuperCallExpression((statement).expression) ? statement : undefined; } } @@ -5190,13 +5196,15 @@ const _super = (function (geti, seti) { if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); + if (baseTypeElement) { - superCall = findInitialSuperCall(ctor); + superCall = getSuperCallAtGivenIndex(ctor, startIndex); if (superCall) { writeLine(); emit(superCall); } } + emitParameterPropertyAssignments(ctor); } else { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 8f66e43c1d6..09100eb61ed 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -464,6 +464,10 @@ namespace ts { return !!(getCombinedNodeFlags(node) & NodeFlags.Let); } + export function isSuperCallExpression(n: Node): boolean { + return n.kind === SyntaxKind.CallExpression && (n).expression.kind === SyntaxKind.SuperKeyword; + } + export function isPrologueDirective(node: Node): boolean { return node.kind === SyntaxKind.ExpressionStatement && (node).expression.kind === SyntaxKind.StringLiteral; } diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js new file mode 100644 index 00000000000..88ce3f1418b --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js @@ -0,0 +1,37 @@ +//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts] +class A { + blub = 6; +} + + +class B extends A { + constructor(public x: number) { + "use strict"; + 'someStringForEgngInject'; + super() + } +} + + +//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.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() { + this.blub = 6; + } + return A; +}()); +var B = (function (_super) { + __extends(B, _super); + function B(x) { + "use strict"; + 'someStringForEgngInject'; + _super.call(this); + this.x = x; + } + return B; +}(A)); diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.symbols b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.symbols new file mode 100644 index 00000000000..3931a7115f6 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts === +class A { +>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 0)) + + blub = 6; +>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 9)) +} + + +class B extends A { +>B : Symbol(B, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 2, 1)) +>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 0)) + + constructor(public x: number) { +>x : Symbol(x, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 6, 16)) + + "use strict"; + 'someStringForEgngInject'; + super() +>super : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.types b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.types new file mode 100644 index 00000000000..cfdf0af0300 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts === +class A { +>A : A + + blub = 6; +>blub : number +>6 : number +} + + +class B extends A { +>B : B +>A : A + + constructor(public x: number) { +>x : number + + "use strict"; +>"use strict" : string + + 'someStringForEgngInject'; +>'someStringForEgngInject' : string + + super() +>super() : void +>super : typeof A + } +} + diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.js b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.js new file mode 100644 index 00000000000..2e594dba0ec --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.js @@ -0,0 +1,29 @@ +//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts] +class A { + blub = 6; +} + + +class B extends A { + constructor(public x: number) { + "use strict"; + 'someStringForEgngInject'; + super() + } +} + + +//// [emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.js] +class A { + constructor() { + this.blub = 6; + } +} +class B extends A { + constructor(x) { + "use strict"; + 'someStringForEgngInject'; + super(); + this.x = x; + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.symbols b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.symbols new file mode 100644 index 00000000000..8b8c09f2611 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts === +class A { +>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 0, 0)) + + blub = 6; +>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 0, 9)) +} + + +class B extends A { +>B : Symbol(B, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 2, 1)) +>A : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 0, 0)) + + constructor(public x: number) { +>x : Symbol(x, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 6, 16)) + + "use strict"; + 'someStringForEgngInject'; + super() +>super : Symbol(A, Decl(emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.types b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.types new file mode 100644 index 00000000000..4424042c241 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts === +class A { +>A : A + + blub = 6; +>blub : number +>6 : number +} + + +class B extends A { +>B : B +>A : A + + constructor(public x: number) { +>x : number + + "use strict"; +>"use strict" : string + + 'someStringForEgngInject'; +>'someStringForEgngInject' : string + + super() +>super() : void +>super : typeof A + } +} + diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js new file mode 100644 index 00000000000..920ad1f7bda --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js @@ -0,0 +1,39 @@ +//// [emitSuperCallBeforeEmitPropertyDeclaration1.ts] +class A { + blub = 6; +} + + +class B extends A { + + blub = 12; + + constructor() { + "use strict"; + 'someStringForEgngInject'; + super() + } +} + +//// [emitSuperCallBeforeEmitPropertyDeclaration1.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() { + this.blub = 6; + } + return A; +}()); +var B = (function (_super) { + __extends(B, _super); + function B() { + "use strict"; + 'someStringForEgngInject'; + _super.call(this); + this.blub = 12; + } + return B; +}(A)); diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.symbols b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.symbols new file mode 100644 index 00000000000..0b118b7c991 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1.ts === +class A { +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 0, 0)) + + blub = 6; +>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 0, 9)) +} + + +class B extends A { +>B : Symbol(B, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 2, 1)) +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 0, 0)) + + blub = 12; +>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 5, 19)) + + constructor() { + "use strict"; + 'someStringForEgngInject'; + super() +>super : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.types b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.types new file mode 100644 index 00000000000..2d16fed121d --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1.ts === +class A { +>A : A + + blub = 6; +>blub : number +>6 : number +} + + +class B extends A { +>B : B +>A : A + + blub = 12; +>blub : number +>12 : number + + constructor() { + "use strict"; +>"use strict" : string + + 'someStringForEgngInject'; +>'someStringForEgngInject' : string + + super() +>super() : void +>super : typeof A + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.js new file mode 100644 index 00000000000..4b3e9e73b9f --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.js @@ -0,0 +1,29 @@ +//// [emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts] +class A { + blub = 6; +} + + +class B extends A { + + blub = 12; + + constructor() { + 'someStringForEgngInject'; + super() + } +} + +//// [emitSuperCallBeforeEmitPropertyDeclaration1ES6.js] +class A { + constructor() { + this.blub = 6; + } +} +class B extends A { + constructor() { + 'someStringForEgngInject'; + super(); + this.blub = 12; + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.symbols b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.symbols new file mode 100644 index 00000000000..4d4b01a3666 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.symbols @@ -0,0 +1,22 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts === +class A { +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 0, 0)) + + blub = 6; +>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 0, 9)) +} + + +class B extends A { +>B : Symbol(B, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 2, 1)) +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 0, 0)) + + blub = 12; +>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 5, 19)) + + constructor() { + 'someStringForEgngInject'; + super() +>super : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.types b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.types new file mode 100644 index 00000000000..39e8f885777 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1ES6.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclaration1ES6.ts === +class A { +>A : A + + blub = 6; +>blub : number +>6 : number +} + + +class B extends A { +>B : B +>A : A + + blub = 12; +>blub : number +>12 : number + + constructor() { + 'someStringForEgngInject'; +>'someStringForEgngInject' : string + + super() +>super() : void +>super : typeof A + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js new file mode 100644 index 00000000000..3fa18140034 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js @@ -0,0 +1,38 @@ +//// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts] +class A { + blub = 6; +} + + +class B extends A { + blah = 2; + constructor(public x: number) { + "use strict"; + 'someStringForEgngInject'; + super() + } +} + +//// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.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() { + this.blub = 6; + } + return A; +}()); +var B = (function (_super) { + __extends(B, _super); + function B(x) { + "use strict"; + 'someStringForEgngInject'; + _super.call(this); + this.x = x; + this.blah = 2; + } + return B; +}(A)); diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.symbols b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.symbols new file mode 100644 index 00000000000..1fb4ed01d85 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts === +class A { +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 0, 0)) + + blub = 6; +>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 0, 9)) +} + + +class B extends A { +>B : Symbol(B, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 2, 1)) +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 0, 0)) + + blah = 2; +>blah : Symbol(blah, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 5, 19)) + + constructor(public x: number) { +>x : Symbol(x, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 7, 16)) + + "use strict"; + 'someStringForEgngInject'; + super() +>super : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.types b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.types new file mode 100644 index 00000000000..acb5703581a --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts === +class A { +>A : A + + blub = 6; +>blub : number +>6 : number +} + + +class B extends A { +>B : B +>A : A + + blah = 2; +>blah : number +>2 : number + + constructor(public x: number) { +>x : number + + "use strict"; +>"use strict" : string + + 'someStringForEgngInject'; +>'someStringForEgngInject' : string + + super() +>super() : void +>super : typeof A + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.js new file mode 100644 index 00000000000..5e27acf8d9a --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.js @@ -0,0 +1,30 @@ +//// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts] +class A { + blub = 6; +} + + +class B extends A { + blah = 2; + constructor(public x: number) { + "use strict"; + 'someStringForEgngInject'; + super() + } +} + +//// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.js] +class A { + constructor() { + this.blub = 6; + } +} +class B extends A { + constructor(x) { + "use strict"; + 'someStringForEgngInject'; + super(); + this.x = x; + this.blah = 2; + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.symbols b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.symbols new file mode 100644 index 00000000000..41cb20f3841 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts === +class A { +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 0, 0)) + + blub = 6; +>blub : Symbol(blub, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 0, 9)) +} + + +class B extends A { +>B : Symbol(B, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 2, 1)) +>A : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 0, 0)) + + blah = 2; +>blah : Symbol(blah, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 5, 19)) + + constructor(public x: number) { +>x : Symbol(x, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 7, 16)) + + "use strict"; + 'someStringForEgngInject'; + super() +>super : Symbol(A, Decl(emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts, 0, 0)) + } +} diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.types b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.types new file mode 100644 index 00000000000..96fc1fc2dc3 --- /dev/null +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.types @@ -0,0 +1,32 @@ +=== tests/cases/compiler/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts === +class A { +>A : A + + blub = 6; +>blub : number +>6 : number +} + + +class B extends A { +>B : B +>A : A + + blah = 2; +>blah : number +>2 : number + + constructor(public x: number) { +>x : number + + "use strict"; +>"use strict" : string + + 'someStringForEgngInject'; +>'someStringForEgngInject' : string + + super() +>super() : void +>super : typeof A + } +} diff --git a/tests/baselines/reference/strictModeInConstructor.js b/tests/baselines/reference/strictModeInConstructor.js index 3b315861548..bcfbdf22414 100644 --- a/tests/baselines/reference/strictModeInConstructor.js +++ b/tests/baselines/reference/strictModeInConstructor.js @@ -75,8 +75,8 @@ var B = (function (_super) { __extends(B, _super); function B() { "use strict"; // No error - this.s = 9; _super.call(this); + this.s = 9; } return B; }(A));