hoist-unmodified-var
Ben McCann 8 months ago
parent 57f1977051
commit a01d4f86ce

@ -2,4 +2,5 @@
'svelte': patch
---
perf: hoist primitives which are not mutated or reassigned and inline into template attributes
perf: inline primitives which are not mutated or reassigned into template attributes

@ -164,7 +164,6 @@ export const javascript_visitors_runes = {
const rune = get_rune(init, state.scope);
if (!rune && init != null && declarator.id.type === 'Identifier') {
const is_top_level = path.at(-1)?.type === 'Program';
const binding = state.scope.owner(declarator.id.name)?.declarations.get(declarator.id.name);
if (is_hoistable_declaration(binding, path)) {
state.hoisted.push(b.declaration('const', declarator.id, init));

Loading…
Cancel
Save