Merge pull request #3856 from Conduitry/gh-3854

deconflict `block` var used in dev mode
pull/3860/head
Rich Harris 5 years ago committed by GitHub
commit 5ad3f6a38b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -376,6 +376,8 @@ export default class Block {
d: ${properties.destroy}
}`;
const block = dev && this.get_unique_name('block');
const body = b`
${Array.from(this.variables.values()).map(({ id, init }) => {
return init
@ -387,9 +389,15 @@ export default class Block {
${dev
? b`
const block = ${return_value};
@dispatch_dev("SvelteRegisterBlock", { block, id: ${this.name || 'create_fragment'}.name, type: "${this.type}", source: "${this.comment ? this.comment.replace(/"/g, '\\"') : ''}", ctx: #ctx });
return block;`
const ${block} = ${return_value};
@dispatch_dev("SvelteRegisterBlock", {
block: ${block},
id: ${this.name || 'create_fragment'}.name,
type: "${this.type}",
source: "${this.comment ? this.comment.replace(/"/g, '\\"') : ''}",
ctx: #ctx
});
return ${block};`
: b`
return ${return_value};`
}

Loading…
Cancel
Save