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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//! §10.4.4 — the arguments exotic object, and the mapping that makes it exotic.
//!
//! # What is exotic about it
//!
//! Nothing about its shape. It is an ordinary object with an ordinary prototype, a `length`, a
//! `callee`, and a property per argument. What is exotic is that some of those properties are
//! *the same variable* as the parameter of the same position: in
//!
//! ```text
//! function f(a) { arguments[0] = 2; return a; }
//! ```
//!
//! `f(1)` answers `2`. Nothing was copied — `arguments[0]` and `a` are one binding seen through
//! two names, and §10.4.4 calls the link between them the *parameter map*.
//!
//! # Why the map is per index, and one-way
//!
//! Because a program can break it, one index at a time. §10.4.4.2 removes an index's mapping when
//! it is redefined as an accessor or made non-writable, and §10.4.4.5 removes it when the property
//! is deleted. Afterwards the two names are two variables and nothing joins them again — so this
//! is a slot per index rather than a count of how many are still mapped.
//!
//! # The unmapped kind is here too
//!
//! §10.4.4 makes one for a strict function, or one whose parameter list is not simple, and both
//! arrive today: `(function (a) { 'use strict'; a = 99; return arguments[0] })(1)` is `1` where the
//! sloppy spelling is `99`, and a default, a rest or a destructuring parameter answers the same way
//! in either mode. A strict one's `callee` throws rather than answering.
//!
//! This section read "What is deliberately not here", on the grounds that "the interpreter tracks
//! no strictness yet, and default, rest and destructuring parameters are refused". All three
//! conditions passed several milestones ago. The *mapping* is what this file is about and the two
//! kinds differ only in whether it exists — which is why one file still serves both.
use crate;
use crateValue;
/// What a call knows that its arguments object needs — §10.4.4.4 and §10.4.4.6's inputs.
///
/// A struct rather than six more parameters, because six of them in a row is a call whose
/// arguments can be silently swapped. Two are `ObjectId`s and two are `bool`s: the compiler could
/// not tell `callee` from `thrower`, nor `mapped` from anything else.
/// Which parameter each argument index is the same variable as — §10.4.4's parameter map.