Merge pull request #3326 from eetulatja/master
Fix spread to work with super method calls
This commit is contained in:
commit
ff2bf2642b
@ -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);
|
||||
},
|
||||
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
bar() {
|
||||
super.bar(arg1, arg2, ...args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
bar() {
|
||||
super.bar.apply(this, [arg1, arg2].concat(babelHelpers.toConsumableArray(args)));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
bar() {
|
||||
super.bar(...args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
bar() {
|
||||
super.bar.apply(this, babelHelpers.toConsumableArray(args));
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user