avoid using prop_source in more cases. bit hacky, could be tidier, but it works

proxied-state-each-blocks
Rich Harris 9 months ago
parent c01fa5c8c8
commit b581a64727

@ -67,7 +67,7 @@ export function serialize_get_binding(node, state) {
if (
binding.kind === 'prop' &&
!binding.mutated &&
!(state.analysis.immutable ? binding.reassigned : binding.mutated) &&
!binding.initial &&
!state.analysis.accessors
) {
@ -364,7 +364,11 @@ export function get_props_method(binding, state, name, default_value) {
// Use $.prop_source in the following cases:
// - accessors/mutated: needs to be able to set the prop value from within
// - default value: we set the fallback value only initially, and it's not possible to know this timing in $.prop
binding.mutated || binding.initial || state.analysis.accessors ? '$.prop_source' : '$.prop',
(state.analysis.immutable ? binding.reassigned : binding.mutated) ||
binding.initial ||
state.analysis.accessors
? '$.prop_source'
: '$.prop',
...args
);
}

Loading…
Cancel
Save