remove unused apparatus around immutable option

proxied-state-each-blocks
Rich Harris 3 years ago
parent 2347fd12f6
commit 95fa5ec66f

@ -261,14 +261,7 @@ export function client_component(source, analysis, options) {
} }
const component_block = b.block([ const component_block = b.block([
b.stmt( b.stmt(b.call('$.push', b.id('$$props'), b.literal(analysis.runes))),
b.call(
'$.push',
b.id('$$props'),
b.literal(analysis.runes),
...(options.immutable ? [b.literal(true)] : [])
)
),
...store_setup, ...store_setup,
...legacy_reactive_declarations, ...legacy_reactive_declarations,
...group_binding_declarations, ...group_binding_declarations,

@ -2104,7 +2104,7 @@ export function server_component(analysis, options) {
} }
const component_block = b.block([ const component_block = b.block([
b.stmt(b.call('$.push', b.literal(analysis.runes), ...(options.immutable ? [b.true] : []))), b.stmt(b.call('$.push', b.literal(analysis.runes))),
.../** @type {import('estree').Statement[]} */ (instance.body), .../** @type {import('estree').Statement[]} */ (instance.body),
.../** @type {import('estree').Statement[]} */ (template.body), .../** @type {import('estree').Statement[]} */ (template.body),
b.stmt(b.call('$.pop')) b.stmt(b.call('$.pop'))

@ -110,8 +110,6 @@ export function create_component_context(props) {
c: null, c: null,
// effects // effects
e: null, e: null,
// immutable
i: false,
// mounted // mounted
m: false, m: false,
// parent // parent
@ -1163,17 +1161,6 @@ export function mutable_source(initial_value) {
return s; return s;
} }
/**
* @returns {import('./types.js').EqualsFunctions}
*/
function get_equals_method() {
const context = current_component_context;
if (context && !context.i) {
return safe_equal;
}
return default_equals;
}
/** /**
* Use `untrack` to prevent something from being treated as an `$effect`/`$derived` dependency. * Use `untrack` to prevent something from being treated as an `$effect`/`$derived` dependency.
* *
@ -1785,13 +1772,11 @@ export function onDestroy(fn) {
/** /**
* @param {import('./types.js').MaybeSignal<Record<string, unknown>>} props * @param {import('./types.js').MaybeSignal<Record<string, unknown>>} props
* @param {any} runes * @param {any} runes
* @param {any} immutable
* @returns {void} * @returns {void}
*/ */
export function push(props, runes = false, immutable = false) { export function push(props, runes = false) {
const context_stack_item = create_component_context(props); const context_stack_item = create_component_context(props);
context_stack_item.r = runes; context_stack_item.r = runes;
context_stack_item.i = immutable;
current_component_context = context_stack_item; current_component_context = context_stack_item;
} }

@ -47,8 +47,6 @@ export type ComponentContext = {
p: null | ComponentContext; p: null | ComponentContext;
/** context */ /** context */
c: null | Map<unknown, unknown>; c: null | Map<unknown, unknown>;
/** immutable */
i: boolean;
/** runes */ /** runes */
r: boolean; r: boolean;
/** update_callbacks */ /** update_callbacks */

@ -115,10 +115,9 @@ export function render(component, options) {
/** /**
* @param {boolean} runes * @param {boolean} runes
* @param {boolean} [immutable]
*/ */
export function push(runes, immutable) { export function push(runes) {
$.push({}, runes, immutable); $.push({}, runes);
} }
export function pop() { export function pop() {

Loading…
Cancel
Save