Skip to content

Commit

Permalink
Merge pull request #3856 from Conduitry/gh-3854
Browse files Browse the repository at this point in the history
deconflict `block` var used in dev mode
  • Loading branch information
Rich-Harris authored Nov 6, 2019
2 parents 601ec45 + 153debb commit 5ad3f6a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/compiler/compile/render_dom/Block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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};`
}
Expand Down

0 comments on commit 5ad3f6a

Please sign in to comment.