diff --git a/lib/6to5/templates/class-super-constructor-call.js b/lib/6to5/templates/class-super-constructor-call.js index a7eb7d15dd..3c5be02aab 100644 --- a/lib/6to5/templates/class-super-constructor-call.js +++ b/lib/6to5/templates/class-super-constructor-call.js @@ -1,2 +1,2 @@ -SUPER_NAME.call(this, arguments); +SUPER_NAME.apply(this, arguments); diff --git a/package.json b/package.json index 2ab0fc93c0..eaec5d67d6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "6to5", "description": "Turn ES6 code into vanilla ES5 with source maps and no runtime", - "version": "1.7.7", + "version": "1.7.8", "author": "Sebastian McKenzie ", "homepage": "https://github.com/sebmck/6to5", "repository": { diff --git a/test/fixtures/classes/constructor/actual.js b/test/fixtures/classes/constructor/actual.js index 62670ab318..2d26f87082 100644 --- a/test/fixtures/classes/constructor/actual.js +++ b/test/fixtures/classes/constructor/actual.js @@ -3,3 +3,9 @@ class Test { this.state = "test"; } } + +class Foo extends Bar { + constructor() { + this.state = "test"; + } +} diff --git a/test/fixtures/classes/constructor/expected.js b/test/fixtures/classes/constructor/expected.js index 718e067e61..73c4d4f672 100644 --- a/test/fixtures/classes/constructor/expected.js +++ b/test/fixtures/classes/constructor/expected.js @@ -4,3 +4,21 @@ var Test = function () { } return Test; }(); + +var Foo = function(Bar) { + function Foo() { + this.state = "test"; + } + + Foo.prototype = Object.create(Bar.prototype, { + constructor: { + value: Foo, + enumerable: false, + writable: true, + configurable: true + } + }); + + Foo.__proto__ = Bar; + return Foo; +}(Bar); diff --git a/test/fixtures/classes/super-class-member-expression/expected.js b/test/fixtures/classes/super-class-member-expression/expected.js index 627d32a72c..1fbc1187f7 100644 --- a/test/fixtures/classes/super-class-member-expression/expected.js +++ b/test/fixtures/classes/super-class-member-expression/expected.js @@ -1,6 +1,6 @@ var BaseController = function (Chaplin) { function BaseController() { - Chaplin.Controller.call(this, arguments); + Chaplin.Controller.apply(this, arguments); } BaseController.prototype = Object.create(Chaplin.Controller.prototype, { constructor: { @@ -16,7 +16,7 @@ var BaseController = function (Chaplin) { var BaseController2 = function (Chaplin) { function BaseController2() { - Chaplin.Controller.Another.call(this, arguments); + Chaplin.Controller.Another.apply(this, arguments); } BaseController2.prototype = Object.create(Chaplin.Controller.Another.prototype, { constructor: { diff --git a/test/fixtures/classes/super-class-non-identifiers/expected.js b/test/fixtures/classes/super-class-non-identifiers/expected.js index 92db8b595e..592bf3b6d2 100644 --- a/test/fixtures/classes/super-class-non-identifiers/expected.js +++ b/test/fixtures/classes/super-class-non-identifiers/expected.js @@ -1,6 +1,6 @@ var Q = function(_ref) { function Q() { - _ref.call(this, arguments); + _ref.apply(this, arguments); } Q.prototype = Object.create(_ref.prototype, { diff --git a/test/fixtures/classes/super-class/expected.js b/test/fixtures/classes/super-class/expected.js index 02d0a2d361..cd513f41a8 100644 --- a/test/fixtures/classes/super-class/expected.js +++ b/test/fixtures/classes/super-class/expected.js @@ -1,6 +1,6 @@ var Test = function (Foo) { function Test() { - Foo.call(this, arguments); + Foo.apply(this, arguments); } Test.prototype = Object.create(Foo.prototype, { constructor: {