fix super spread in loose mode
This commit is contained in:
parent
83bcaba1a5
commit
85308a1e8c
@ -169,7 +169,13 @@ export default class ReplaceSupers {
|
||||
|
||||
if (methodName.name === "constructor") {
|
||||
// constructor() { super(); }
|
||||
return t.memberExpression(superRef, t.identifier("call"));
|
||||
if (parent.arguments.length === 2 && t.isSpreadElement(parent.arguments[1]) && t.isIdentifier(parent.arguments[1].argument, { name: "arguments" })) {
|
||||
// special case single arguments spread
|
||||
parent.arguments[1] = parent.arguments[1].argument;
|
||||
return t.memberExpression(superRef, t.identifier("apply"));
|
||||
} else {
|
||||
return t.memberExpression(superRef, t.identifier("call"));
|
||||
}
|
||||
} else {
|
||||
id = superRef;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import * as t from "../../../types";
|
||||
|
||||
function getSpreadLiteral(spread, scope) {
|
||||
if (scope.hub.file.isLoose("es6.spread")) {
|
||||
if (scope.hub.file.isLoose("es6.spread") && !t.isIdentifier(spread.argument, { name: "arguments" })) {
|
||||
return spread.argument;
|
||||
} else {
|
||||
return scope.toArray(spread.argument, true);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user