Skip to content

Commit 4eac5ba

Browse files
committed
desc
1 parent dae9081 commit 4eac5ba

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

packages/svelte/src/compiler/phases/3-transform/server/transform-server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ function store_sub_exist(bindings) {
372372
for (const reference of binding.references) {
373373
const node = reference.path.at(-1);
374374

375-
// make sure it is not a sub in a directive e.g. use:$store as it is unneeded
375+
// hacky way to ensure the sub is not in a directive e.g. use:$store as it is unneeded
376376
if (node?.type !== 'RegularElement') {
377377
return true;
378378
}

packages/svelte/src/compiler/phases/scope.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -288,17 +288,6 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
288288
next({ scope });
289289
};
290290

291-
/**
292-
* @type {import('zimmerframe').Visitor<import('#compiler').Directive, State, import('#compiler').SvelteNode>}
293-
*/
294-
const SvelteDirective = (node, context) => {
295-
const name = node.name;
296-
297-
if (name[0] === '$') {
298-
context.state.scope.reference(b.id(name), context.path);
299-
}
300-
};
301-
302291
/**
303292
* @param {import('#compiler').ElementLike} node
304293
* @param {Scope} parent
@@ -341,6 +330,18 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
341330
return /** @type {const} */ ([scope, is_default_slot]);
342331
}
343332

333+
/**
334+
* Reference store in transion:, use:, animate: directives
335+
* @type {import('zimmerframe').Visitor<import('#compiler').Directive, State, import('#compiler').SvelteNode>}
336+
*/
337+
const SvelteDirective = (node, context) => {
338+
const name = node.name;
339+
340+
if (name[0] === '$') {
341+
context.state.scope.reference(b.id(name), context.path);
342+
}
343+
};
344+
344345
walk(ast, state, {
345346
// references
346347
Identifier(node, { path, state }) {

0 commit comments

Comments
 (0)