chore: remove reactive_statements from state (#15363)

pull/15380/head
Rich Harris 6 months ago committed by GitHub
parent bfeb9ad448
commit 1b882fb1b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -269,8 +269,7 @@ export function analyze_module(ast, options) {
has_props_rune: false, has_props_rune: false,
options: /** @type {ValidatedCompileOptions} */ (options), options: /** @type {ValidatedCompileOptions} */ (options),
parent_element: null, parent_element: null,
reactive_statement: null, reactive_statement: null
reactive_statements: new Map()
}, },
visitors visitors
); );
@ -619,8 +618,7 @@ export function analyze_component(root, source, options) {
expression: null, expression: null,
derived_state: [], derived_state: [],
function_depth: scope.function_depth, function_depth: scope.function_depth,
reactive_statement: null, reactive_statement: null
reactive_statements: new Map()
}; };
walk(/** @type {AST.SvelteNode} */ (ast), state, visitors); walk(/** @type {AST.SvelteNode} */ (ast), state, visitors);
@ -683,7 +681,6 @@ export function analyze_component(root, source, options) {
has_props_rune: false, has_props_rune: false,
ast_type: ast === instance.ast ? 'instance' : ast === template.ast ? 'template' : 'module', ast_type: ast === instance.ast ? 'instance' : ast === template.ast ? 'template' : 'module',
reactive_statement: null, reactive_statement: null,
reactive_statements: analysis.reactive_statements,
component_slots: new Set(), component_slots: new Set(),
expression: null, expression: null,
derived_state: [], derived_state: [],

@ -1,7 +1,6 @@
import type { Scope } from '../scope.js'; import type { Scope } from '../scope.js';
import type { ComponentAnalysis, ReactiveStatement } from '../types.js'; import type { ComponentAnalysis, ReactiveStatement } from '../types.js';
import type { AST, ExpressionMetadata, ValidatedCompileOptions } from '#compiler'; import type { AST, ExpressionMetadata, ValidatedCompileOptions } from '#compiler';
import type { LabeledStatement } from 'estree';
export interface AnalysisState { export interface AnalysisState {
scope: Scope; scope: Scope;
@ -24,7 +23,6 @@ export interface AnalysisState {
// legacy stuff // legacy stuff
reactive_statement: null | ReactiveStatement; reactive_statement: null | ReactiveStatement;
reactive_statements: Map<LabeledStatement, ReactiveStatement>;
} }
export type Context<State extends AnalysisState = AnalysisState> = import('zimmerframe').Context< export type Context<State extends AnalysisState = AnalysisState> = import('zimmerframe').Context<

@ -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 ( if (
node.body.type === 'ExpressionStatement' && node.body.type === 'ExpressionStatement' &&

Loading…
Cancel
Save