diff --git a/packages/svelte/src/compiler/phases/3-transform/server/visitors/ClassDeclaration.js b/packages/svelte/src/compiler/phases/3-transform/server/visitors/ClassDeclaration.js index 8543cb4083..dfacea85f8 100644 --- a/packages/svelte/src/compiler/phases/3-transform/server/visitors/ClassDeclaration.js +++ b/packages/svelte/src/compiler/phases/3-transform/server/visitors/ClassDeclaration.js @@ -7,26 +7,26 @@ import * as b from '#compiler/builders'; * @param {Context} context */ export function ClassDeclaration(node, context) { - /** @type {ServerTransformState & { computed_field_declarations: VariableDeclaration[] }} */ - const state = { - ...context.state, - computed_field_declarations: [] - }; - const super_class = node.superClass - ? /** @type {Expression} */ (context.visit(node.superClass)) - : null; - const body = /** @type {ClassBody} */ (context.visit(node.body, state)); - if (state.computed_field_declarations.length > 0) { - const init = b.call( - b.arrow( - [], - b.block([ - ...state.computed_field_declarations, - b.return(b.class(node.id, body, super_class)) - ]) - ) - ); - return node.id ? b.var(node.id, init) : init; - } - return b.class_declaration(node.id, body, super_class); + /** @type {ServerTransformState & { computed_field_declarations: VariableDeclaration[] }} */ + const state = { + ...context.state, + computed_field_declarations: [] + }; + const super_class = node.superClass + ? /** @type {Expression} */ (context.visit(node.superClass)) + : null; + const body = /** @type {ClassBody} */ (context.visit(node.body, state)); + if (state.computed_field_declarations.length > 0) { + const init = b.call( + b.arrow( + [], + b.block([ + ...state.computed_field_declarations, + b.return(b.class(node.id, body, super_class)) + ]) + ) + ); + return node.id ? b.var(node.id, init) : init; + } + return b.class_declaration(node.id, body, super_class); }