Skip to main content

set_with_receiver

Function set_with_receiver 

Source
pub fn set_with_receiver(
    target: &Value,
    key: &str,
    val: Value,
    receiver: &Value,
) -> Result<bool, String>
Expand description

OrdinarySetWithOwnDescriptor (10.1.9.2) with a receiver distinct from the object the lookup started on — what Reflect.set(t, k, v, receiver) and a proxy set trap forwarding to it both need.

The distinction that matters: an accessor found on target’s chain RUNS, with receiver as this; a data property does not write to target at all but is CREATED on receiver through its [[DefineOwnProperty]]. Routing that second case back through [[Set]] made a proxy receiver re-enter its own set trap forever — the trap body Reflect.set(t, k, v, recv) is the documented way to forward a write, so the recursion hit every faithful handler.