Fixes setter paratemer default value (#8479)
* Fixes setter paratemer default value * Not changes doesn't mutate loose variable
This commit is contained in:
committed by
Justin Ridgewell
parent
3989213e37
commit
5043ec78bc
@@ -60,7 +60,8 @@ export default function convertFunctionParams(path, loose) {
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
const param = params[i];
|
||||
|
||||
if (param.isAssignmentPattern() && loose) {
|
||||
const paramIsAssignmentPattern = param.isAssignmentPattern();
|
||||
if (paramIsAssignmentPattern && (loose || node.kind === "set")) {
|
||||
const left = param.get("left");
|
||||
const right = param.get("right");
|
||||
|
||||
@@ -87,13 +88,12 @@ export default function convertFunctionParams(path, loose) {
|
||||
);
|
||||
param.replaceWith(paramName);
|
||||
}
|
||||
} else if (param.isAssignmentPattern()) {
|
||||
} else if (paramIsAssignmentPattern) {
|
||||
if (firstOptionalIndex === null) firstOptionalIndex = i;
|
||||
|
||||
const left = param.get("left");
|
||||
const right = param.get("right");
|
||||
|
||||
//
|
||||
if (!state.iife) {
|
||||
if (right.isIdentifier() && !isSafeBinding(scope, right.node)) {
|
||||
// the right hand side references a parameter
|
||||
|
||||
Reference in New Issue
Block a user