skip work in runes mode

pull/16038/head
Rich Harris 4 months ago
parent 74f735003d
commit 406761164a

@ -39,20 +39,19 @@ export function EachBlock(node, context) {
if (node.key) context.visit(node.key); if (node.key) context.visit(node.key);
if (node.fallback) context.visit(node.fallback); if (node.fallback) context.visit(node.fallback);
let mutated = false; if (!context.state.analysis.runes) {
let mutated =
!!node.context &&
extract_identifiers(node.context).some((id) => {
const binding = context.state.scope.get(id.name);
return !!binding?.mutated;
});
// collect transitive dependencies... // collect transitive dependencies...
for (const binding of node.metadata.expression.dependencies) { for (const binding of node.metadata.expression.dependencies) {
collect_transitive_dependencies(binding, node.metadata.transitive_deps); collect_transitive_dependencies(binding, node.metadata.transitive_deps);
} }
if (node.context) {
for (const id of extract_identifiers(node.context)) {
const binding = context.state.scope.get(id.name);
if (binding?.mutated) mutated = true;
}
}
// ...and ensure they are marked as state, so they can be turned // ...and ensure they are marked as state, so they can be turned
// into mutable sources and invalidated // into mutable sources and invalidated
if (mutated) { if (mutated) {
@ -67,6 +66,7 @@ export function EachBlock(node, context) {
} }
} }
} }
}
mark_subtree_dynamic(context.path); mark_subtree_dynamic(context.path);
} }

Loading…
Cancel
Save