declare $vars up top

pull/2099/head
Richard Harris 6 years ago
parent 5af301abb8
commit 70ddabde7f

@ -312,7 +312,6 @@ export default function dom(
const reactive_store_subscriptions = reactive_stores.length > 0 && reactive_stores const reactive_store_subscriptions = reactive_stores.length > 0 && reactive_stores
.map(({ name }) => deindent` .map(({ name }) => deindent`
let ${name};
${component.compileOptions.dev && `@validate_store(${name.slice(1)}, '${name.slice(1)}');`} ${component.compileOptions.dev && `@validate_store(${name.slice(1)}, '${name.slice(1)}');`}
$$self.$$.on_destroy.push(${name.slice(1)}.subscribe($$value => { ${name} = $$value; $$invalidate('${name}', ${name}); })); $$self.$$.on_destroy.push(${name.slice(1)}.subscribe($$value => { ${name} = $$value; $$invalidate('${name}', ${name}); }));
`) `)
@ -345,6 +344,8 @@ export default function dom(
builder.addBlock(deindent` builder.addBlock(deindent`
function ${definition}(${args.join(', ')}) { function ${definition}(${args.join(', ')}) {
${reactive_stores.length > 0 && `let ${reactive_stores.map(store => store.name).join(', ')};`}
${user_code} ${user_code}
${renderer.slots.size && `let { ${[...renderer.slots].map(name => `$$slot_${sanitize(name)}`).join(', ')}, $$scope } = $$props;`} ${renderer.slots.size && `let { ${[...renderer.slots].map(name => `$$slot_${sanitize(name)}`).join(', ')}, $$scope } = $$props;`}

Loading…
Cancel
Save