From 7a52cec1e01b4cdab2fe0e264612fe2a74ccca82 Mon Sep 17 00:00:00 2001 From: Bassam Ismail Date: Tue, 16 Jun 2020 09:01:00 +0530 Subject: [PATCH] fix(5019): mark imported stores as hoistable --- src/compiler/compile/Component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index 1a28e8dfc89..481960760a9 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -632,7 +632,6 @@ export default class Component { this.add_var({ name, initialised: instance_scope.initialised_declarations.has(name), - hoistable: true, writable }); @@ -1153,7 +1152,9 @@ export default class Component { for (const specifier of specifiers) { const variable = var_lookup.get(specifier.local.name); - if (!variable.mutated) variable.hoistable = true; + if (!variable.mutated || var_lookup.get(`$${specifier.local.name}`)) { + variable.hoistable = true; + } } } }