pull/15792/head
Rich Harris 4 months ago
parent ffc4769571
commit 930c5325db

@ -91,7 +91,9 @@ export function Identifier(node, context) {
if (context.state.expression) {
context.state.expression.dependencies.add(binding);
context.state.expression.has_state ||=
!binding.is_function() && !context.state.scope.evaluate(node).is_known;
binding.kind !== 'static' &&
!binding.is_function() &&
!context.state.scope.evaluate(node).is_known;
}
if (

@ -1153,7 +1153,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
const is_keyed =
node.key &&
(node.key.type !== 'Identifier' || !node.index || node.key.name !== node.index);
scope.declare(b.id(node.index), is_keyed ? 'template' : 'normal', 'const', node);
scope.declare(b.id(node.index), is_keyed ? 'template' : 'static', 'const', node);
}
if (node.key) visit(node.key, { scope });

@ -265,7 +265,8 @@ export type BindingKind =
| 'snippet' // A snippet parameter
| 'store_sub' // A $store value
| 'legacy_reactive' // A `$:` declaration
| 'template'; // A binding declared in the template, e.g. in an `await` block or `const` tag
| 'template' // A binding declared in the template, e.g. in an `await` block or `const` tag
| 'static'; // A binding whose value is known to be static (i.e. each index)
export type DeclarationKind =
| 'var'

Loading…
Cancel
Save