Infer names of anonymous functions in logical assignments (#11658)
This is a partial revert of #11370, updating the tests to match the [new consensus](https://github.com/babel/proposals/issues/66#issuecomment-636984546).
This commit is contained in:
@@ -39,16 +39,11 @@ export default declare(api => {
|
||||
}
|
||||
}
|
||||
|
||||
const isRHSAnonymousFunction = t.isFunction(right, { id: null });
|
||||
const rightExpression = isRHSAnonymousFunction
|
||||
? t.sequenceExpression([t.numericLiteral(0), right])
|
||||
: right;
|
||||
|
||||
path.replaceWith(
|
||||
t.logicalExpression(
|
||||
operator.slice(0, -1),
|
||||
lhs,
|
||||
t.assignmentExpression("=", left, rightExpression),
|
||||
t.assignmentExpression("=", left, right),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user