Skip to content

Commit f6aa8b2

Browse files
committed
handle store subscriptions
1 parent 4888860 commit f6aa8b2

File tree

1 file changed

+9
-9
lines changed
  • packages/svelte/src/compiler/phases/2-analyze

1 file changed

+9
-9
lines changed

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,18 +1071,18 @@ function is_safe_identifier(expression, scope) {
10711071
if (node.type !== 'Identifier') return false;
10721072

10731073
const binding = scope.get(node.name);
1074+
if (!binding) return true;
10741075

1075-
if (
1076-
binding &&
1077-
(binding.kind === 'prop' ||
1078-
binding.kind === 'bindable_prop' ||
1079-
binding.kind === 'rest_prop' ||
1080-
binding.declaration_kind === 'import')
1081-
) {
1082-
return false;
1076+
if (binding.kind === 'store_sub') {
1077+
return is_safe_identifier({ name: node.name.slice(1), type: 'Identifier' }, scope);
10831078
}
10841079

1085-
return true;
1080+
return (
1081+
binding.declaration_kind !== 'import' &&
1082+
binding.kind !== 'prop' &&
1083+
binding.kind !== 'bindable_prop' &&
1084+
binding.kind !== 'rest_prop'
1085+
);
10861086
}
10871087

10881088
/** @type {import('./types').Visitors} */

0 commit comments

Comments
 (0)