remove component.imported_declarations

pull/2011/head
Richard Harris 7 years ago
parent 2147d71a0b
commit e3468f425b

@ -62,7 +62,6 @@ export default class Component {
module_javascript: string; module_javascript: string;
javascript: string; javascript: string;
imported_declarations: Set<string> = new Set();
hoistable_nodes: Set<Node> = new Set(); hoistable_nodes: Set<Node> = new Set();
node_for_declaration: Map<string, Node> = new Map(); node_for_declaration: Map<string, Node> = new Map();
partly_hoisted: string[] = []; partly_hoisted: string[] = [];
@ -422,8 +421,6 @@ export default class Component {
module: is_module, module: is_module,
hoistable: true hoistable: true
}); });
this.imported_declarations.add(specifier.local.name);
}); });
} }
}); });
@ -837,7 +834,7 @@ export default class Component {
// reference instance variables other than other // reference instance variables other than other
// hoistable functions. TODO others? // hoistable functions. TODO others?
const { hoistable_nodes, imported_declarations, var_lookup } = this; const { hoistable_nodes, var_lookup } = this;
const top_level_function_declarations = new Map(); const top_level_function_declarations = new Map();

@ -288,7 +288,9 @@ export default class Expression {
} else { } else {
names.forEach(name => { names.forEach(name => {
if (scope.declarations.has(name)) return; if (scope.declarations.has(name)) return;
if (component.imported_declarations.has(name)) return;
const variable = component.var_lookup.get(name);
if (variable && variable.hoistable) return;
pending_assignments.add(name); pending_assignments.add(name);
}); });
@ -297,7 +299,9 @@ export default class Expression {
const { name } = getObject(node.argument); const { name } = getObject(node.argument);
if (scope.declarations.has(name)) return; if (scope.declarations.has(name)) return;
if (component.imported_declarations.has(name)) return;
const variable = component.var_lookup.get(name);
if (variable && variable.hoistable) return;
pending_assignments.add(name); pending_assignments.add(name);
} }

@ -178,9 +178,11 @@ export default function dom(
code.overwrite(node.start, node.end, dirty.map(n => `$$invalidate('${n}', ${n})`).join('; ')); code.overwrite(node.start, node.end, dirty.map(n => `$$invalidate('${n}', ${n})`).join('; '));
} else { } else {
names.forEach(name => { names.forEach(name => {
if (component.imported_declarations.has(name)) return;
if (scope.findOwner(name) !== component.instance_scope) return; if (scope.findOwner(name) !== component.instance_scope) return;
const variable = component.var_lookup.get(name);
if (variable && variable.hoistable) return;
pending_assignments.add(name); pending_assignments.add(name);
component.has_reactive_assignments = true; component.has_reactive_assignments = true;
}); });
@ -190,9 +192,11 @@ export default function dom(
else if (node.type === 'UpdateExpression') { else if (node.type === 'UpdateExpression') {
const { name } = getObject(node.argument); const { name } = getObject(node.argument);
if (component.imported_declarations.has(name)) return;
if (scope.findOwner(name) !== component.instance_scope) return; if (scope.findOwner(name) !== component.instance_scope) return;
const variable = component.var_lookup.get(name);
if (variable && variable.hoistable) return;
pending_assignments.add(name); pending_assignments.add(name);
component.has_reactive_assignments = true; component.has_reactive_assignments = true;
} }

Loading…
Cancel
Save