Skip to content

Commit f1f7d90

Browse files
authored
[fix] handle AssignmentPattern with ObjectPattern in rewrite_identifier (#6715)
1 parent 7e156c0 commit f1f7d90

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/compiler/compile/Component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,11 @@ export default class Component {
10441044
break;
10451045

10461046
case 'AssignmentPattern':
1047-
param.left = get_new_name(param.left);
1047+
if (param.left.type === 'Identifier') {
1048+
param.left = get_new_name(param.left);
1049+
} else {
1050+
rename_identifiers(param.left);
1051+
}
10481052
break;
10491053
}
10501054
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
html: `
3+
<div>hello undefined</div>
4+
<div>hello bar2</div>
5+
`
6+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script>
2+
const hoge = {};
3+
const { foo: { bar } = {} } = hoge;
4+
5+
6+
const hoge2 = {};
7+
const { foo2: { bar2 } = { bar2: "bar2" } } = hoge2;
8+
</script>
9+
10+
<div>hello {bar}</div>
11+
<div>hello {bar2}</div>

0 commit comments

Comments
 (0)