diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index 5c83d1f346..202e14fd98 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -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; } } diff --git a/test/runtime/samples/destructured-assignment-pattern-with-object-pattern/_config.js b/test/runtime/samples/destructured-assignment-pattern-with-object-pattern/_config.js new file mode 100644 index 0000000000..75025e4614 --- /dev/null +++ b/test/runtime/samples/destructured-assignment-pattern-with-object-pattern/_config.js @@ -0,0 +1,6 @@ +export default { + html: ` +
hello undefined
+
hello bar2
+ ` +}; diff --git a/test/runtime/samples/destructured-assignment-pattern-with-object-pattern/main.svelte b/test/runtime/samples/destructured-assignment-pattern-with-object-pattern/main.svelte new file mode 100644 index 0000000000..b71b25bd67 --- /dev/null +++ b/test/runtime/samples/destructured-assignment-pattern-with-object-pattern/main.svelte @@ -0,0 +1,11 @@ + + +
hello {bar}
+
hello {bar2}