Merge pull request #3326 from eetulatja/master

Fix spread to work with super method calls
This commit is contained in:
Logan Smyth 2016-02-10 22:49:02 -07:00
commit ff2bf2642b
5 changed files with 24 additions and 0 deletions

View File

@ -101,6 +101,10 @@ export default function ({ types: t }) {
node.callee = t.memberExpression(node.callee, t.identifier("apply"));
}
if (t.isSuper(contextLiteral)) {
contextLiteral = t.thisExpression();
}
node.arguments.unshift(contextLiteral);
},

View File

@ -0,0 +1,5 @@
class Foo {
bar() {
super.bar(arg1, arg2, ...args);
}
}

View File

@ -0,0 +1,5 @@
class Foo {
bar() {
super.bar.apply(this, [arg1, arg2].concat(babelHelpers.toConsumableArray(args)));
}
}

View File

@ -0,0 +1,5 @@
class Foo {
bar() {
super.bar(...args);
}
}

View File

@ -0,0 +1,5 @@
class Foo {
bar() {
super.bar.apply(this, babelHelpers.toConsumableArray(args));
}
}