Fix spread to work with super method calls
This commit is contained in:
@@ -101,6 +101,10 @@ export default function ({ types: t }) {
|
|||||||
node.callee = t.memberExpression(node.callee, t.identifier("apply"));
|
node.callee = t.memberExpression(node.callee, t.identifier("apply"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (t.isSuper(contextLiteral)) {
|
||||||
|
contextLiteral = t.thisExpression();
|
||||||
|
}
|
||||||
|
|
||||||
node.arguments.unshift(contextLiteral);
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user