tweaks and fixes

pull/1864/head
Rich Harris 7 years ago
parent c75b73937f
commit 1638aec061

@ -109,7 +109,10 @@ export default class Expression {
if (isReference(node, parent)) { if (isReference(node, parent)) {
const { name, nodes } = flattenReference(node); const { name, nodes } = flattenReference(node);
if (currentScope.has(name)) return; if (currentScope.has(name)) {
contextual_dependencies.add(name);
return;
}
if (component.helpers.has(name)) { if (component.helpers.has(name)) {
let object = node; let object = node;
@ -121,7 +124,6 @@ export default class Expression {
} }
expression.usesContext = true; expression.usesContext = true;
contextual_dependencies.add(name);
if (!isSynthetic && !isEventHandler) { if (!isSynthetic && !isEventHandler) {
// <option> value attribute could be synthetic — avoid double editing // <option> value attribute could be synthetic — avoid double editing

@ -650,9 +650,9 @@ export default class ElementWrapper extends Wrapper {
}); });
block.builders.init.addBlock(deindent` block.builders.init.addBlock(deindent`
${name}.$on("${handler.name}", function(event) { function ${name}(event) {
ctx.${handler_name}.call(this, event, ctx); ctx.${handler_name}.call(this, event, ctx);
}); }
`); `);
} else { } else {
name = `ctx.${handler_name}`; name = `ctx.${handler_name}`;

@ -71,10 +71,12 @@ export class SvelteComponent {
} }
$set(values) { $set(values) {
this.$$.inject_props(values); if (this.$$) {
run_all(this.$$onprops); this.$$.inject_props(values);
run_all(this.$$onprops);
for (const key in values) this.$$make_dirty(key); for (const key in values) this.$$make_dirty(key);
}
} }
$$update() { $$update() {
@ -85,10 +87,12 @@ export class SvelteComponent {
} }
$$destroy(detach) { $$destroy(detach) {
this.$$fragment.d(detach); if (this.$$) {
run_all(this.$$ondestroy); this.$$fragment.d(detach);
run_all(this.$$ondestroy);
// TODO null out other refs // TODO null out other refs
this.$$ondestroy = null; this.$$ondestroy = this.$$fragment = this.$$ = null;
}
} }
} }
Loading…
Cancel
Save