handle store subscriptions

pull/11319/head
Rich Harris 2 years ago
parent 4888860a18
commit f6aa8b2de2

@ -1071,18 +1071,18 @@ function is_safe_identifier(expression, scope) {
if (node.type !== 'Identifier') return false; if (node.type !== 'Identifier') return false;
const binding = scope.get(node.name); const binding = scope.get(node.name);
if (!binding) return true;
if ( if (binding.kind === 'store_sub') {
binding && return is_safe_identifier({ name: node.name.slice(1), type: 'Identifier' }, scope);
(binding.kind === 'prop' ||
binding.kind === 'bindable_prop' ||
binding.kind === 'rest_prop' ||
binding.declaration_kind === 'import')
) {
return false;
} }
return true; return (
binding.declaration_kind !== 'import' &&
binding.kind !== 'prop' &&
binding.kind !== 'bindable_prop' &&
binding.kind !== 'rest_prop'
);
} }
/** @type {import('./types').Visitors} */ /** @type {import('./types').Visitors} */

Loading…
Cancel
Save