committed by
GitHub
parent
20d2b4f98d
commit
e4f3964f67
13
node_modules/@babel/traverse/lib/path/conversion.js
generated
vendored
13
node_modules/@babel/traverse/lib/path/conversion.js
generated
vendored
@ -251,10 +251,11 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
|
||||
const flatSuperProps = superProps.reduce((acc, superProp) => acc.concat(standardizeSuperProperty(superProp)), []);
|
||||
flatSuperProps.forEach(superProp => {
|
||||
const key = superProp.node.computed ? "" : superProp.get("property").node.name;
|
||||
const isAssignment = superProp.parentPath.isAssignmentExpression({
|
||||
const superParentPath = superProp.parentPath;
|
||||
const isAssignment = superParentPath.isAssignmentExpression({
|
||||
left: superProp.node
|
||||
});
|
||||
const isCall = superProp.parentPath.isCallExpression({
|
||||
const isCall = superParentPath.isCallExpression({
|
||||
callee: superProp.node
|
||||
});
|
||||
const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key);
|
||||
@ -265,18 +266,18 @@ function hoistFunctionEnvironment(fnPath, noNewArrows = true, allowInsertArrow =
|
||||
}
|
||||
|
||||
if (isAssignment) {
|
||||
const value = superProp.parentPath.node.right;
|
||||
const value = superParentPath.node.right;
|
||||
args.push(value);
|
||||
}
|
||||
|
||||
const call = callExpression(identifier(superBinding), args);
|
||||
|
||||
if (isCall) {
|
||||
superProp.parentPath.unshiftContainer("arguments", thisExpression());
|
||||
superParentPath.unshiftContainer("arguments", thisExpression());
|
||||
superProp.replaceWith(memberExpression(call, identifier("call")));
|
||||
thisPaths.push(superProp.parentPath.get("arguments.0"));
|
||||
thisPaths.push(superParentPath.get("arguments.0"));
|
||||
} else if (isAssignment) {
|
||||
superProp.parentPath.replaceWith(call);
|
||||
superParentPath.replaceWith(call);
|
||||
} else {
|
||||
superProp.replaceWith(call);
|
||||
}
|
||||
|
Reference in New Issue
Block a user