Merge pull request #2198 from sveltejs/svelte-self

fix svelte:self
pull/2201/head
Rich Harris 7 years ago committed by GitHub
commit 19bcb33bc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save