This repository has been archived by the owner on Jan 26, 2022. It is now read-only.
generated from tc39/template-for-proposals
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathspec.emu
173 lines (152 loc) · 11.1 KB
/
spec.emu
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!doctype html>
<meta charset="utf8">
<link rel="stylesheet" href="./spec.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css">
<script src="./spec.js"></script>
<pre class="metadata">
title: Error Cause
stage: 1
contributors: Chengzhong Wu, Hemanth HM, Ecma International
</pre>
<style>
#sec-placeholder, [href="#sec-placeholder"] {
display: none;
}
</style>
<script>
Array.from(document.querySelectorAll('ol.toc li'), function (node) {
if (node.querySelector(':scope > [href="#sec-placeholder"]')) {
node.style.display = 'none';
}
});
</script>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-abstract-operations">
<h1>Abstract Operations</h1>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-operations-on-objects">
<h1>Operations on Objects</h1>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-createnonenumerabledatapropertyorthrow">
<h1><ins>CreateNonEnumerableDataPropertyOrThrow ( _O_, _P_, _V_ )</ins></h1>
<p><ins>The abstract operation CreateNonEnumerableDataPropertyOrThrow takes arguments _O_ (an Object), _P_ (a Property Key), and _V_ (an ECMAScript language value). It is used to create a new non-enumerable own property of an object. It throws a *TypeError* exception if the requested property update cannot be performed. It performs the following steps when called:</ins></p>
<emu-alg>
1. <ins>Let _newDesc_ be the PropertyDescriptor { [[Value]]: _V_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</ins>
1. <ins>Return ? DefinePropertyOrThrow(_O_, _P_, _newDesc_).</ins>
</emu-alg>
</emu-clause>
<emu-note>This abstract operation creates a property whose attributes are set to the same defaults used for properties created by the ECMAScript language assignment operator except they are not enumerable. Normally, the property will not already exist. If it does exist and is not configurable or if _O_ is not extensible, [[DefineOwnProperty]] will return *false* causing this operation to throw a *TypeError* exception.</emu-note>
</emu-clause>
</emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-fundamental-objects">
<h1>Fundamental Objects</h1>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-error-objects">
<h1>Error Objects</h1>
<emu-clause id="sec-error-constructor">
<h1>The Error Constructor</h1>
<emu-clause id="sec-error-message">
<h1>Error ( _message_<ins> [ , _options_ ]</ins> )</h1>
<p>When the `Error` function is called with argument _message_<ins> and optional argument _options_</ins>, the following steps are taken:</p>
<emu-alg>
1. If NewTarget is *undefined*, let _newTarget_ be the active function object; else let _newTarget_ be NewTarget.
1. Let _O_ be ? OrdinaryCreateFromConstructor(_newTarget_, `"%Error.prototype%"`, « [[ErrorData]] »).
1. If _message_ is not *undefined*, then
1. Let _msg_ be ? ToString(_message_).
1. <del>Let _msgDesc_ be the PropertyDescriptor { [[Value]]: _msg_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</del>
1. <del>Perform ! DefinePropertyOrThrow(_O_, *"message"*, _msgDesc_).</del>
1. <ins>Perform ! CreateNonEnumerableDataPropertyOrThrow(_O_, *"message"*, _msg_).</ins>
1. <ins>Perform ? InstallErrorCause(_O_, _options_). </ins>
1. Return O.
</emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-placeholder"><h1>Placeholder to ensure correct clause numbering</h1></emu-clause>
<emu-clause id="sec-nativeerror-object-structure">
<h1>_NativeError_ Object Structure</h1>
<emu-clause id="sec-nativeerror-constructors">
<h1>The _NativeError_ Constructors</h1>
<emu-clause id="sec-nativeerror">
<h1>_NativeError_ ( _message_<ins> [ , _options_ ]</ins> )</h1>
<p>When a _NativeError_ function is called with argument _message_<ins> and optional argument _options_</ins>, the following steps are taken:</p>
<emu-alg>
1. If NewTarget is *undefined*, let _newTarget_ be the active function object; else let _newTarget_ be NewTarget.
1. [id="step-nativerror-ordinarycreatefromconstructor"] Let _O_ be ? OrdinaryCreateFromConstructor(_newTarget_, <code>"%<var>NativeError</var>.prototype%"</code>, « [[ErrorData]] »).
1. If _message_ is not *undefined*, then
1. Let _msg_ be ? ToString(_message_).
1. <del>Let _msgDesc_ be the PropertyDescriptor { [[Value]]: _msg_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</del>
1. <del>Perform ! DefinePropertyOrThrow(_O_, *"message"*, _msgDesc_).</del>
1. <ins>Perform ! CreateNonEnumerableDataPropertyOrThrow(_O_, *"message"*, _msg_).</ins>
1. <ins>Perform ? InstallErrorCause(_O_, _options_). </ins>
1. Return _O_.
</emu-alg>
<p>The actual value of the string passed in step <emu-xref href="#step-nativerror-ordinarycreatefromconstructor"></emu-xref> is either *"%EvalError.prototype%"*, *"%RangeError.prototype%"*, *"%ReferenceError.prototype%"*, *"%SyntaxError.prototype%"*, *"%TypeError.prototype%"*, or *"%URIError.prototype%"* corresponding to which _NativeError_ constructor is being defined.</p>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-aggregate-error-objects">
<h1>AggregateError Objects</h1>
<emu-clause id="sec-aggregate-error-constructor">
<h1>The AggregateError Constructor</h1>
<emu-clause id="sec-aggregate-error">
<h1>AggregateError ( _errors_, _message_<ins> [ , _options_ ]</ins> )</h1>
<p>When the *AggregateError* function is called with arguments _errors_<del> and</del><ins>,</ins> _message_<ins>, and optional argument _options_</ins>, the following steps are taken:</p>
<emu-alg>
1. If NewTarget is *undefined*, let _newTarget_ be the active function object; else let _newTarget_ be NewTarget.
1. Let _O_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%AggregateError.prototype%"*, « [[ErrorData]] »).
1. If _message_ is not *undefined*, then
1. Let _msg_ be ? ToString(_message_).
1. <del>Let _msgDesc_ be the PropertyDescriptor { [[Value]]: _msg_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</del>
1. <del>Perform ! DefinePropertyOrThrow(_O_, *"message"*, _msgDesc_).</del>
1. <ins>Perform ! CreateNonEnumerableDataPropertyOrThrow(_O_, *"message"*, _msg_).</ins>
1. <ins>Perform ? InstallErrorCause(_O_, _options_). </ins>
1. Let _errorsList_ be ? IterableToList(_errors_).
1. Perform ! DefinePropertyOrThrow(_O_, *"errors"*, PropertyDescriptor { [[Configurable]]: *true*, [[Enumerable]]: *false*, [[Writable]]: *true*, [[Value]]: ! CreateArrayFromList(_errorsList_) }).
1. Return _O_.
</emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-errorobjects-abstracts">
<h1>Abstract Operations for Error Objects</h1>
<emu-clause id="sec-errorobjects-install-error-cause">
<h1><ins>InstallErrorCause ( _O_, _options_ )</ins></h1>
<p><ins>The abstract operation InstallErrorCause takes arguments _O_ (an Object) and _options_. It is used to create `"cause"` property on _O_ when the `"cause"` property is present on _options_. It performs the following steps when called:</ins></p>
<emu-alg>
1. <ins>If Type(_options_) is Object and ? HasProperty(_options_, `"cause"`) is *true*, then</ins>
1. <ins>Let _cause_ be ? Get(_options_, `"cause"`).</ins>
1. <ins>Perform ! CreateNonEnumerableDataPropertyOrThrow(_O_, `"cause"`, _cause_).</ins>
1. <ins>Return NormalCompletion(*undefined*).</ins>
</emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
</emu-clause>