pub struct ProxyState {
pub target: Option<Gc<JsObject>>,
pub handler: Option<Value>,
pub callable: bool,
pub constructible: bool,
}Expand description
The two slots of a proxy, shared with its revoke function.
None in both slots means revoked: every operation then throws a TypeError, and
the target and handler are no longer reachable — which is the whole point of
Proxy.revocable.
Fields§
§target: Option<Gc<JsObject>>The object the traps receive, or None once revoked.
handler: Option<Value>The trap table, or None once revoked.
callable: boolWhether this proxy has a [[Call]], decided once when it is created.
Revoking drops the target but does not take [[Call]] away, so this cannot be
re-derived from target being Some: typeof p.proxy has to stay "function"
after Proxy.revocable(function(){}, {}).revoke(), and the reference agrees.
constructible: boolWhether this proxy has a [[Construct]], decided once when it is created.
Same reasoning as ProxyState::callable, and the two are genuinely independent:
Proxy.revocable(function(){}, {}) is both callable and constructible, while a
proxy over an arrow function is callable and not constructible.