Skip to content

Commit

Permalink
chore: remove reactive_statements from state (#15363)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris authored Feb 24, 2025
1 parent bfeb9ad commit 1b882fb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
7 changes: 2 additions & 5 deletions packages/svelte/src/compiler/phases/2-analyze/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ export function analyze_module(ast, options) {
has_props_rune: false,
options: /** @type {ValidatedCompileOptions} */ (options),
parent_element: null,
reactive_statement: null,
reactive_statements: new Map()
reactive_statement: null
},
visitors
);
Expand Down Expand Up @@ -619,8 +618,7 @@ export function analyze_component(root, source, options) {
expression: null,
derived_state: [],
function_depth: scope.function_depth,
reactive_statement: null,
reactive_statements: new Map()
reactive_statement: null
};

walk(/** @type {AST.SvelteNode} */ (ast), state, visitors);
Expand Down Expand Up @@ -683,7 +681,6 @@ export function analyze_component(root, source, options) {
has_props_rune: false,
ast_type: ast === instance.ast ? 'instance' : ast === template.ast ? 'template' : 'module',
reactive_statement: null,
reactive_statements: analysis.reactive_statements,
component_slots: new Set(),
expression: null,
derived_state: [],
Expand Down
2 changes: 0 additions & 2 deletions packages/svelte/src/compiler/phases/2-analyze/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Scope } from '../scope.js';
import type { ComponentAnalysis, ReactiveStatement } from '../types.js';
import type { AST, ExpressionMetadata, ValidatedCompileOptions } from '#compiler';
import type { LabeledStatement } from 'estree';

export interface AnalysisState {
scope: Scope;
Expand All @@ -24,7 +23,6 @@ export interface AnalysisState {

// legacy stuff
reactive_statement: null | ReactiveStatement;
reactive_statements: Map<LabeledStatement, ReactiveStatement>;
}

export type Context<State extends AnalysisState = AnalysisState> = import('zimmerframe').Context<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function LabeledStatement(node, context) {
}
}

context.state.reactive_statements.set(node, reactive_statement);
context.state.analysis.reactive_statements.set(node, reactive_statement);

if (
node.body.type === 'ExpressionStatement' &&
Expand Down

0 comments on commit 1b882fb

Please sign in to comment.