1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! §10.5's Proxy exotic object — a target, a handler, and the pair being revocable together.
//!
//! # Why a Proxy is not a wrapper
//!
//! Every other exotic object in ViperJS answers *more* than an ordinary one: a String object has
//! characters, a TypedArray has elements, an Array has a live `length`. A Proxy answers **less** on
//! its own — it has no properties of its own at all — and instead hands each of §6.1.7.2's internal
//! methods to a function the handler supplies, falling back to the target when there is none.
//!
//! That inverts where the work happens. A String object's extra behaviour lives in the heap,
//! because reading a character needs no interpreter. A Proxy's lives in the interpreter, because
//! calling a trap is calling JavaScript — so what is here is only the state, and every one of the
//! thirteen operations is in [`crate::vm`].
//!
//! # Why revoking clears both
//!
//! §10.5.14's revocation function sets the target *and* the handler to null, and §10.5's every
//! internal method then throws a TypeError. Holding one `Option` for the pair rather than two is
//! what makes "half revoked" unrepresentable: there is no state in which a trap could be looked up
//! on a handler that is gone, or run against a target that is.
use crateObjectId;
/// §10.5's `[[ProxyTarget]]` and `[[ProxyHandler]]`, or nothing once revoked.