[fix] handle AssignmentPattern with ObjectPattern in rewrite_identifier (#6715)

pull/6721/head
Shinobu Hayashi 3 years ago committed by GitHub
parent 7e156c014e
commit f1f7d90240
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1044,7 +1044,11 @@ export default class Component {
break;
case 'AssignmentPattern':
param.left = get_new_name(param.left);
if (param.left.type === 'Identifier') {
param.left = get_new_name(param.left);
} else {
rename_identifiers(param.left);
}
break;
}
}

@ -0,0 +1,6 @@
export default {
html: `
<div>hello undefined</div>
<div>hello bar2</div>
`
};

@ -0,0 +1,11 @@
<script>
const hoge = {};
const { foo: { bar } = {} } = hoge;
const hoge2 = {};
const { foo2: { bar2 } = { bar2: "bar2" } } = hoge2;
</script>
<div>hello {bar}</div>
<div>hello {bar2}</div>
Loading…
Cancel
Save