pull/16126/head
Rich Harris 3 months ago
parent b1f761c197
commit 4105d055f9

@ -138,7 +138,7 @@ export function VariableDeclaration(node, context) {
if (rune === '$state' && is_proxy) { if (rune === '$state' && is_proxy) {
value = b.call('$.proxy', value); value = b.call('$.proxy', value);
if (dev) { if (dev && !is_state) {
value = b.call('$.tag_proxy', value, b.literal(id.name)); value = b.call('$.tag_proxy', value, b.literal(id.name));
} }
} }

@ -187,6 +187,8 @@ export function get_stack(label) {
*/ */
export function tag(source, label) { export function tag(source, label) {
source.label = label; source.label = label;
tag_proxy(source.v, label);
return source; return source;
} }

@ -12,7 +12,7 @@ import { state as source, set } from './reactivity/sources.js';
import { PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants'; import { PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';
import { UNINITIALIZED } from '../../constants.js'; import { UNINITIALIZED } from '../../constants.js';
import * as e from './errors.js'; import * as e from './errors.js';
import { get_stack, tag, tag_proxy } from './dev/tracing.js'; import { get_stack, tag } from './dev/tracing.js';
import { tracing_mode_flag } from '../flags/index.js'; import { tracing_mode_flag } from '../flags/index.js';
// TODO move all regexes into shared module? // TODO move all regexes into shared module?
@ -75,10 +75,7 @@ export function proxy(value) {
// rename all child sources and child proxies // rename all child sources and child proxies
for (const [prop, source] of sources) { for (const [prop, source] of sources) {
var label = get_label(path, prop); tag(source, get_label(path, prop));
tag(source, label);
tag_proxy(source.v, label);
} }
} }
@ -165,9 +162,7 @@ export function proxy(value) {
var s = source(p, stack); var s = source(p, stack);
if (DEV) { if (DEV) {
var label = get_label(path, prop); tag(s, get_label(path, prop));
tag(s, label);
tag_proxy(p, label);
} }
return s; return s;
@ -225,9 +220,7 @@ export function proxy(value) {
var s = source(p, stack); var s = source(p, stack);
if (DEV) { if (DEV) {
var label = get_label(path, prop); tag(s, get_label(path, prop));
tag(s, label);
tag_proxy(p, label);
} }
return s; return s;
@ -281,23 +274,16 @@ export function proxy(value) {
return s; return s;
}); });
sources.set(prop, s);
if (DEV) { if (DEV) {
var label = get_label(path, prop); tag(s, get_label(path, prop));
tag(s, label);
tag_proxy(s.v, label);
} }
sources.set(prop, s);
} }
} else { } else {
has = s.v !== UNINITIALIZED; has = s.v !== UNINITIALIZED;
var p = with_parent(() => proxy(value)); var p = with_parent(() => proxy(value));
if (DEV) {
tag_proxy(p, get_label(path, prop));
}
set(s, p); set(s, p);
} }

@ -141,7 +141,7 @@ export function set(source, value, should_proxy = false) {
let new_value = should_proxy ? proxy(value) : value; let new_value = should_proxy ? proxy(value) : value;
if (DEV && should_proxy) { if (DEV) {
tag_proxy(new_value, /** @type {string} */ (source.label)); tag_proxy(new_value, /** @type {string} */ (source.label));
} }

Loading…
Cancel
Save