Summary
Reflect.get and Reflect.set currently ignore the optional receiver argument. Per ES2026 §28.1.5 and §28.1.12, the receiver must be threaded through the internal [[Get]]/[[Set]] operations so that:
Reflect.get — if the resolved property is an accessor, the getter is called with receiver as this (defaults to target when omitted).
Reflect.set — if the resolved property is an accessor, the setter is called with receiver as this; for data properties, the write lands on receiver rather than target (defaults to target when omitted).
Skipping the receiver produces incorrect results for inherited setters and breaks the Proxy forwarding pattern (Reflect.set(target, prop, value, receiver) inside a set trap).
What needs to change
In units/Goccia.Builtins.GlobalReflect.pas:
ReflectGet — extract AArgs.GetElement(2) as Receiver (default to Target if absent) and call TGocciaObjectValue.GetPropertyWithContext (or equivalent) instead of GetProperty/GetSymbolProperty.
ReflectSet — extract the optional Receiver argument (default to Target) and thread it into the set logic via the existing OrdinarySet/SetWithContext helper so inherited setters observe the correct this.
This may require deeper changes to the property-access pipeline (GetPropertyWithContext/SetPropertyWithContext) to propagate the receiver cleanly.
References
Summary
Reflect.getandReflect.setcurrently ignore the optionalreceiverargument. Per ES2026 §28.1.5 and §28.1.12, the receiver must be threaded through the internal[[Get]]/[[Set]]operations so that:Reflect.get— if the resolved property is an accessor, the getter is called withreceiverasthis(defaults totargetwhen omitted).Reflect.set— if the resolved property is an accessor, the setter is called withreceiverasthis; for data properties, the write lands onreceiverrather thantarget(defaults totargetwhen omitted).Skipping the receiver produces incorrect results for inherited setters and breaks the Proxy forwarding pattern (
Reflect.set(target, prop, value, receiver)inside asettrap).What needs to change
In
units/Goccia.Builtins.GlobalReflect.pas:ReflectGet— extractAArgs.GetElement(2)asReceiver(default toTargetif absent) and callTGocciaObjectValue.GetPropertyWithContext(or equivalent) instead ofGetProperty/GetSymbolProperty.ReflectSet— extract the optionalReceiverargument (default toTarget) and thread it into the set logic via the existingOrdinarySet/SetWithContexthelper so inherited setters observe the correctthis.This may require deeper changes to the property-access pipeline (
GetPropertyWithContext/SetPropertyWithContext) to propagate the receiver cleanly.References