Skip to content

Commit 75c448c

Browse files
committed
remove PROXY_REMOVE_PATH
1 parent 3d161ee commit 75c448c

File tree

4 files changed

+11
-24
lines changed

4 files changed

+11
-24
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { get_rune } from '../../../scope.js';
99
import { get_prop_source, is_prop_source, is_state_source, should_proxy } from '../utils.js';
1010
import { is_hoisted_function } from '../../utils.js';
1111
import { get_value } from './shared/declarations.js';
12-
import { PROXY_REMOVE_PATH } from '#client/constants';
1312

1413
/**
1514
* @param {VariableDeclaration} node
@@ -90,12 +89,7 @@ export function VariableDeclaration(node, context) {
9089
binding.kind === 'bindable_prop' &&
9190
should_proxy(initial, context.state.scope)
9291
) {
93-
initial = b.call(
94-
'$.proxy',
95-
initial,
96-
dev ? b.literal(id.name) : undefined,
97-
dev ? b.literal(PROXY_REMOVE_PATH) : undefined
98-
);
92+
initial = b.call('$.proxy', initial, dev ? b.literal(id.name) : undefined);
9993
}
10094

10195
if (is_prop_source(binding, context.state)) {
@@ -136,20 +130,19 @@ export function VariableDeclaration(node, context) {
136130
);
137131
const is_state = is_state_source(binding, context.state.analysis);
138132
const is_proxy = should_proxy(value, context.state.scope);
133+
139134
if (rune === '$state' && is_proxy) {
140-
value = b.call(
141-
'$.proxy',
142-
value,
143-
dev ? b.literal(id.name) : undefined,
144-
dev ? b.literal(PROXY_REMOVE_PATH) : undefined
145-
);
135+
value = b.call('$.proxy', value, dev ? b.literal(id.name) : undefined);
146136
}
137+
147138
if (is_state) {
148139
value = b.call('$.state', value);
140+
141+
if (dev) {
142+
value = b.call('$.tag', value, b.literal(id.name));
143+
}
149144
}
150-
if (dev && is_state) {
151-
value = b.call('$.tag', value, b.literal(id.name));
152-
}
145+
153146
return value;
154147
};
155148

packages/svelte/src/internal/client/constants.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ export const EFFECT_IS_UPDATING = 1 << 21;
2727
export const PROXY_PRESERVE_PATH = 1 << 1;
2828
/** Change proxy path to new "owner" */
2929
export const PROXY_CHANGE_PATH = 1 << 2;
30-
/** "Unown" proxy, so its path becomes `[$state proxy]` */
31-
export const PROXY_REMOVE_PATH = 1 << 3;
3230

3331
export const STATE_SYMBOL = Symbol('$state');
3432
export const LEGACY_PROPS = Symbol('legacy props');

packages/svelte/src/internal/client/proxy.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
PROXY_CHANGE_PATH,
1414
PROXY_PATH_SYMBOL,
1515
PROXY_PRESERVE_PATH,
16-
PROXY_REMOVE_PATH,
1716
STATE_SYMBOL
1817
} from '#client/constants';
1918
import { UNINITIALIZED } from '../../constants.js';

packages/svelte/src/internal/client/reactivity/sources.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ import {
2727
UNOWNED,
2828
MAYBE_DIRTY,
2929
BLOCK_EFFECT,
30-
ROOT_EFFECT,
31-
PROXY_REMOVE_PATH
30+
ROOT_EFFECT
3231
} from '#client/constants';
3332
import * as e from '../errors.js';
3433
import { legacy_mode_flag, tracing_mode_flag } from '../../flags/index.js';
@@ -140,9 +139,7 @@ export function set(source, value, should_proxy = false) {
140139
e.state_unsafe_mutation();
141140
}
142141

143-
let new_value = should_proxy
144-
? proxy(value, DEV ? source.trace_name : undefined, DEV ? PROXY_REMOVE_PATH : undefined)
145-
: value;
142+
let new_value = should_proxy ? proxy(value, DEV ? source.trace_name : undefined) : value;
146143

147144
return internal_set(source, new_value);
148145
}

0 commit comments

Comments
 (0)