Merge pull request #2261 from sveltejs/gh-2253

fix renamed instance exports
pull/2267/head
Rich Harris 6 years ago committed by GitHub
commit 3e2366d360
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -834,7 +834,7 @@ export default class Component {
current_group.declarators.push(declarator); current_group.declarators.push(declarator);
} }
if (variable.name !== variable.export_name) { if (variable.writable && variable.name !== variable.export_name) {
code.prependRight(declarator.id.start, `${variable.export_name}: `) code.prependRight(declarator.id.start, `${variable.export_name}: `)
} }

@ -114,7 +114,7 @@ export default function dom(
if (component.component_options.accessors) { if (component.component_options.accessors) {
body.push(deindent` body.push(deindent`
set ${x.export_name}(${x.name}) { set ${x.export_name}(${x.name}) {
this.$set({ ${x.name} }); this.$set({ ${x.name === x.export_name ? x.name : `${x.export_name}: ${x.name}`} });
@flush(); @flush();
} }
`); `);

@ -0,0 +1,10 @@
export default {
test({ assert, component }) {
assert.equal(component.bar1, 42);
assert.equal(component.bar2, 42);
component.bar1 = 100;
component.bar2 = 100;
assert.equal(component.bar1, 42);
assert.equal(component.bar2, 100);
}
};

@ -0,0 +1,5 @@
<script>
const foo1 = 42;
let foo2 = 42;
export { foo1 as bar1, foo2 as bar2 };
</script>
Loading…
Cancel
Save