0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00

fix svelte:self

This commit is contained in:
Richard Harris 2019-03-10 13:13:57 -04:00
parent dd6a962f3e
commit 885ad257b7

View File

@ -63,7 +63,7 @@ export default class InlineComponentWrapper extends Wrapper {
});
this.var = (
this.node.name === 'svelte:self' ? '__svelte:self__' : // TODO conflict-proof this
this.node.name === 'svelte:self' ? renderer.component.name :
this.node.name === 'svelte:component' ? 'switch_instance' :
this.node.name
).toLowerCase();
@ -452,7 +452,7 @@ export default class InlineComponentWrapper extends Wrapper {
block.builders.destroy.addLine(`if (${name}) ${name}.$destroy(${parentNode ? '' : 'detach'});`);
} else {
const expression = this.node.name === 'svelte:self'
? component.name
? '__svelte:self__' // TODO conflict-proof this
: component.qualify(this.node.name);
block.builders.init.addBlock(deindent`