From 0bc2e55caed79fcd846f2276f7b91a27872a813d Mon Sep 17 00:00:00 2001 From: Nic <162764842+Nic-Polumeyv@users.noreply.github.com> Date: Sun, 6 Sep 2026 19:47:53 -0400 Subject: [PATCH] fmt --- .../src/compiler/phases/1-parse/state/tag.js | 3 +-- packages/svelte/src/compiler/phases/scope.js | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/svelte/src/compiler/phases/1-parse/state/tag.js b/packages/svelte/src/compiler/phases/1-parse/state/tag.js index 09983e7035..cc0edee6bc 100644 --- a/packages/svelte/src/compiler/phases/1-parse/state/tag.js +++ b/packages/svelte/src/compiler/phases/1-parse/state/tag.js @@ -2,9 +2,8 @@ /** @import { AST } from '#compiler' */ /** @import { Parser } from '../index.js' */ import * as e from '../../../errors.js'; -import { ExpressionMetadata } from '../../nodes.js'; +import { create_fragment, ExpressionMetadata } from '../../nodes.js'; import { read_expression, read_params, read_pattern, read_statement } from '../js.js'; -import { create_fragment } from '../../nodes.js'; import { find_matching_bracket, match_bracket } from '../utils/bracket.js'; const regex_whitespace_with_closing_curly_brace = /\s*}/y; diff --git a/packages/svelte/src/compiler/phases/scope.js b/packages/svelte/src/compiler/phases/scope.js index 9d84e058a9..0125f8c244 100644 --- a/packages/svelte/src/compiler/phases/scope.js +++ b/packages/svelte/src/compiler/phases/scope.js @@ -961,7 +961,8 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) { for (const binding of parsed.bindings) { if ((binding.kind === 'param') !== params) continue; // no node: `arguments`, or a declaration erased with the TypeScript it belonged to - if (binding.node === null || binding.kind === 'class-name' || binding.kind === 'pattern') continue; + if (binding.node === null || binding.kind === 'class-name' || binding.kind === 'pattern') + continue; /** @type {DeclarationKind} */ let kind = 'let'; switch (binding.kind) { @@ -1078,10 +1079,13 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) { const parsed = scopeOf(/** @type {any} */ (node)); const parent = context.path.at(-1); if (parsed === undefined) { - const of_function = node.type === 'BlockStatement' && parent && scopeOf(/** @type {any} */ (parent)); + const of_function = + node.type === 'BlockStatement' && parent && scopeOf(/** @type {any} */ (parent)); if ( of_function && - (parent.type === 'FunctionDeclaration' || parent.type === 'FunctionExpression' || parent.type === 'ArrowFunctionExpression') + (parent.type === 'FunctionDeclaration' || + parent.type === 'FunctionExpression' || + parent.type === 'ArrowFunctionExpression') ) { // the body holds the non-porous function scope; the parameters live one above const scope = context.state.scope.child(); @@ -1097,7 +1101,8 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) { scopes.set(node, scope); declare_parsed(scope, parsed, true, /** @type {any} */ (node)); if (node.type === 'FunctionExpression' && node.id) declare_parsed(scope, parsed, false); - else if (node.type === 'ArrowFunctionExpression' && node.body.type !== 'BlockStatement') declare_parsed(scope, parsed, false); + else if (node.type === 'ArrowFunctionExpression' && node.body.type !== 'BlockStatement') + declare_parsed(scope, parsed, false); return context.next({ scope }); } case 'block': @@ -1211,7 +1216,9 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) { ImportDeclaration(node, { state }) { for (const specifier of node.specifiers) { - const binding = declared(specifier.local) ?? state.scope.declare(specifier.local, 'normal', 'import', node); + const binding = + declared(specifier.local) ?? + state.scope.declare(specifier.local, 'normal', 'import', node); binding.initial = node; } },