|
|
|
|
@ -437,7 +437,8 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
|
|
|
|
|
next();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
VariableDeclaration(node, { state, next }) {
|
|
|
|
|
VariableDeclaration(node, { state, path, next }) {
|
|
|
|
|
const is_parent_const_tag = path.at(-1)?.type === 'ConstTag';
|
|
|
|
|
for (const declarator of node.declarations) {
|
|
|
|
|
/** @type {import('#compiler').Binding[]} */
|
|
|
|
|
const bindings = [];
|
|
|
|
|
@ -445,7 +446,12 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
|
|
|
|
|
state.scope.declarators.set(declarator, bindings);
|
|
|
|
|
|
|
|
|
|
for (const id of extract_identifiers(declarator.id)) {
|
|
|
|
|
const binding = state.scope.declare(id, 'normal', node.kind, declarator.init);
|
|
|
|
|
const binding = state.scope.declare(
|
|
|
|
|
id,
|
|
|
|
|
is_parent_const_tag ? 'derived' : 'normal',
|
|
|
|
|
node.kind,
|
|
|
|
|
declarator.init
|
|
|
|
|
);
|
|
|
|
|
bindings.push(binding);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -594,7 +600,8 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
ConstTag(node, { state, next }) {
|
|
|
|
|
for (const identifier of extract_identifiers(node.expression.left)) {
|
|
|
|
|
const declaration = node.declaration.declarations[0];
|
|
|
|
|
for (const identifier of extract_identifiers(declaration.id)) {
|
|
|
|
|
state.scope.declare(
|
|
|
|
|
/** @type {import('estree').Identifier} */ (identifier),
|
|
|
|
|
'derived',
|
|
|
|
|
|