fix super constructor call - fixes #34

This commit is contained in:
Sebastian McKenzie
2014-10-10 20:37:15 +11:00
parent c4a3a08d31
commit 58da989164
7 changed files with 30 additions and 6 deletions

View File

@@ -1,2 +1,2 @@
SUPER_NAME.call(this, arguments);
SUPER_NAME.apply(this, arguments);

View File

@@ -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 <sebmck@gmail.com>",
"homepage": "https://github.com/sebmck/6to5",
"repository": {

View File

@@ -3,3 +3,9 @@ class Test {
this.state = "test";
}
}
class Foo extends Bar {
constructor() {
this.state = "test";
}
}

View File

@@ -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);

View File

@@ -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: {

View File

@@ -1,6 +1,6 @@
var Q = function(_ref) {
function Q() {
_ref.call(this, arguments);
_ref.apply(this, arguments);
}
Q.prototype = Object.create(_ref.prototype, {

View File

@@ -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: {