1
1
<!doctype html>
2
2
<meta charset =" utf8" >
3
3
<link rel =" shortcut icon" href =" https://tc39.github.io/ecma262/img/favicon.ico" />
4
- <link rel =" stylesheet" href =" ecmarkup.css" >
5
- <link rel =" stylesheet" href =" https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css" >
6
- <script src =" ecmarkup.js" ></script >
7
4
<pre class =metadata >
8
5
title : Function.prototype.toString revision
9
6
status : proposal
10
7
stage : 3
11
8
contributors : Michael Ficarra
12
- toc : true
9
+ location : https://github.com/tc39/Function-prototype-toString-revision
13
10
</pre >
14
11
15
12
16
- <emu-intro >
13
+ <emu-intro id = " sec-introduction " >
17
14
<h1 >Introduction</h1 >
18
15
<h2 >Goals</h2 >
19
16
@@ -49,8 +46,8 @@ <h2>Goals</h2>
49
46
50
47
51
48
<!-- es6num="5.2" -->
52
- <emu-clause id =" sec-algorithm-conventions" >
53
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-algorithm-conventions" >5.2</a >) Algorithm Conventions</h1 >
49
+ <emu-clause id =" proposal- sec-algorithm-conventions" >
50
+ <h1 >(<emu-xref href =" #sec-algorithm-conventions" >5.2</emu-xref >) Algorithm Conventions</h1 >
54
51
<p >The specification often uses a numbered list to specify steps in an algorithm. These algorithms are used to precisely specify the required semantics of ECMAScript language constructs. The algorithms are not intended to imply the use of any specific implementation technique. In practice, there may be more efficient algorithms available to implement a given feature.</p >
55
52
<p >Algorithms may be explicitly parameterized, in which case the names and usage of the parameters must be provided as part of the algorithm's definition. In order to facilitate their use in multiple parts of this specification, some algorithms, called <em >abstract operations</em >, are named and written in parameterized functional form so that they may be referenced by name from within other algorithms. Abstract operations are typically referenced using a functional application style such as operationName(_arg1_ , _arg2_ ). Some abstract operations are treated as polymorphically dispatched methods of class-like specification abstractions. Such method-like abstract operations are typically referenced using a method application style such as _someValue_ .operationName(_arg1_ , _arg2_ ).</p >
56
53
<p >Calls to abstract operations return Completion Records. Abstract operations referenced using the functional application style and the method application style that are prefixed by `?` indicate that ReturnIfAbrupt should be applied to the resulting Completion Record. For example, ? operationName() is equivalent to ReturnIfAbrupt(operationName()). Similarly, ? _someValue_ .operationName() is equivalent to ReturnIfAbrupt(_someValue_ .operationName()).</p >
@@ -98,8 +95,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-algorithm-conventions">5.2</a>)
98
95
99
96
100
97
<!-- 9.2 -->
101
- <emu-clause id =" sec-ecmascript-function-objects" >
102
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-ecmascript-function-objects" >9.2</a >) ECMAScript Function Objects</h1 >
98
+ <emu-clause id =" proposal- sec-ecmascript-function-objects" >
99
+ <h1 >(<emu-xref href =" #sec-ecmascript-function-objects" >9.2</emu-xref >) ECMAScript Function Objects</h1 >
103
100
<p >ECMAScript function objects encapsulate parameterized ECMAScript code closed over a lexical environment and support the dynamic evaluation of that code. An ECMAScript function object is an ordinary object and has the same internal slots and the same internal methods as other ordinary objects. The code of an ECMAScript function object may be either strict mode code (<emu-xref href =" #sec-strict-mode-code" ></emu-xref >) or non-strict mode code. An ECMAScript function object whose code is strict mode code is called a <em >strict function</em >. One whose code is not strict mode code is called a <em >non-strict function</em >.</p >
104
101
<p >ECMAScript function objects have the additional internal slots listed in <emu-xref href =" #table-27" ></emu-xref >.</p >
105
102
<emu-table id =" table-27" caption =" Internal Slots of ECMAScript Function Objects" >
@@ -129,8 +126,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-ecmascript-function-objects">9.
129
126
130
127
131
128
<!-- 14.1.19 -->
132
- <emu-clause id =" sec-function-definitions-runtime-semantics-instantiatefunctionobject" >
133
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-function-definitions-runtime-semantics-instantiatefunctionobject" >14.1.19</a >) Runtime Semantics: InstantiateFunctionObject</h1 >
129
+ <emu-clause id =" proposal- sec-function-definitions-runtime-semantics-instantiatefunctionobject" >
130
+ <h1 >(<emu-xref href =" #sec-function-definitions-runtime-semantics-instantiatefunctionobject" >14.1.19</emu-xref >) Runtime Semantics: InstantiateFunctionObject</h1 >
134
131
<p >With parameter _scope_ .</p >
135
132
<emu-see-also-para op =" InstantiateFunctionObject" ></emu-see-also-para >
136
133
<emu-grammar >FunctionDeclaration : ` function` BindingIdentifier ` (` FormalParameters ` )` ` {` FunctionBody ` }` </emu-grammar >
@@ -159,8 +156,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-function-definitions-runtime-se
159
156
160
157
161
158
<!-- 14.1.20 -->
162
- <emu-clause id =" sec-function-definitions-runtime-semantics-evaluation" >
163
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-function-definitions-runtime-semantics-evaluation" >14.1.20</a >) Runtime Semantics: Evaluation</h1 >
159
+ <emu-clause id =" proposal- sec-function-definitions-runtime-semantics-evaluation" >
160
+ <h1 >(<emu-xref href =" #sec-function-definitions-runtime-semantics-evaluation" >14.1.20</emu-xref >) Runtime Semantics: Evaluation</h1 >
164
161
<emu-grammar >FunctionDeclaration : ` function` BindingIdentifier ` (` FormalParameters ` )` ` {` FunctionBody ` }` </emu-grammar >
165
162
<emu-alg >
166
163
1. Return NormalCompletion(~empty~ ).
@@ -210,8 +207,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-function-definitions-runtime-se
210
207
211
208
212
209
<!-- 14.2.16 -->
213
- <emu-clause id =" sec-arrow-function-definitions-runtime-semantics-evaluation" >
214
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-arrow-function-definitions-runtime-semantics-evaluation" >14.2.16</a >) Runtime Semantics: Evaluation</h1 >
210
+ <emu-clause id =" proposal- sec-arrow-function-definitions-runtime-semantics-evaluation" >
211
+ <h1 >(<emu-xref href =" #sec-arrow-function-definitions-runtime-semantics-evaluation" >14.2.16</emu-xref >) Runtime Semantics: Evaluation</h1 >
215
212
<emu-grammar >ArrowFunction : ArrowParameters ` =>` ConciseBody </emu-grammar >
216
213
<emu-alg >
217
214
1. If the function code for this | ArrowFunction | is strict mode code, let _strict_ be *true* . Otherwise let _strict_ be *false* .
@@ -228,8 +225,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-arrow-function-definitions-runt
228
225
229
226
230
227
<!-- 14.3.8 -->
231
- <emu-clause id =" sec-runtime-semantics-definemethod" >
232
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-runtime-semantics-definemethod" >14.3.8</a >) Runtime Semantics: DefineMethod</h1 >
228
+ <emu-clause id =" proposal- sec-runtime-semantics-definemethod" >
229
+ <h1 >(<emu-xref href =" #sec-runtime-semantics-definemethod" >14.3.8</emu-xref >) Runtime Semantics: DefineMethod</h1 >
233
230
<p >With parameters _object_ and optional parameter _functionPrototype_ .</p >
234
231
<emu-grammar >MethodDefinition : PropertyName ` (` StrictFormalParameters ` )` ` {` FunctionBody ` }` </emu-grammar >
235
232
<emu-alg >
@@ -247,8 +244,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-runtime-semantics-definemethod"
247
244
248
245
249
246
<!-- 14.3.9 -->
250
- <emu-clause id =" sec-method-definitions-runtime-semantics-propertydefinitionevaluation" >
251
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-method-definitions-runtime-semantics-propertydefinitionevaluation" >14.3.9</a >) Runtime Semantics: PropertyDefinitionEvaluation</h1 >
247
+ <emu-clause id =" proposal- sec-method-definitions-runtime-semantics-propertydefinitionevaluation" >
248
+ <h1 >(<emu-xref href =" #sec-method-definitions-runtime-semantics-propertydefinitionevaluation" >14.3.9</emu-xref >) Runtime Semantics: PropertyDefinitionEvaluation</h1 >
252
249
<p >With parameters _object_ and _enumerable_ .</p >
253
250
<emu-see-also-para op =" PropertyDefinitionEvaluation" ></emu-see-also-para >
254
251
<emu-grammar >MethodDefinition : PropertyName ` (` StrictFormalParameters ` )` ` {` FunctionBody ` }` </emu-grammar >
@@ -292,8 +289,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-method-definitions-runtime-sema
292
289
293
290
294
291
<!-- 14.4.12 -->
295
- <emu-clause id =" sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject" >
296
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject" >14.4.12</a >) Runtime Semantics: InstantiateFunctionObject</h1 >
292
+ <emu-clause id =" proposal- sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject" >
293
+ <h1 >(<emu-xref href =" #sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject" >14.4.12</emu-xref >) Runtime Semantics: InstantiateFunctionObject</h1 >
297
294
<p >With parameter _scope_ .</p >
298
295
<emu-see-also-para op =" InstantiateFunctionObject" ></emu-see-also-para >
299
296
<emu-grammar >GeneratorDeclaration : ` function` ` *` BindingIdentifier ` (` FormalParameters ` )` ` {` GeneratorBody ` }` </emu-grammar >
@@ -324,8 +321,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-generator-function-definitions-
324
321
325
322
326
323
<!-- 14.4.13 -->
327
- <emu-clause id =" sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation" >
328
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation" >14.4.13</a >) Runtime Semantics: PropertyDefinitionEvaluation</h1 >
324
+ <emu-clause id =" proposal- sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation" >
325
+ <h1 >(<emu-xref href =" #sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation" >14.4.13</emu-xref >) Runtime Semantics: PropertyDefinitionEvaluation</h1 >
329
326
<p >With parameter _object_ and _enumerable_ .</p >
330
327
<emu-see-also-para op =" PropertyDefinitionEvaluation" ></emu-see-also-para >
331
328
<emu-grammar >GeneratorMethod : ` *` PropertyName ` (` StrictFormalParameters ` )` ` {` GeneratorBody ` }` </emu-grammar >
@@ -347,8 +344,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-generator-function-definitions-
347
344
348
345
349
346
<!-- 14.4.14 -->
350
- <emu-clause id =" sec-generator-function-definitions-runtime-semantics-evaluation" >
351
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-generator-function-definitions-runtime-semantics-evaluation" >14.4.14</a >) Runtime Semantics: Evaluation</h1 >
347
+ <emu-clause id =" proposal- sec-generator-function-definitions-runtime-semantics-evaluation" >
348
+ <h1 >(<emu-xref href =" #sec-generator-function-definitions-runtime-semantics-evaluation" >14.4.14</emu-xref >) Runtime Semantics: Evaluation</h1 >
352
349
<emu-grammar >GeneratorExpression : ` function` ` *` ` (` FormalParameters ` )` ` {` GeneratorBody ` }` </emu-grammar >
353
350
<emu-alg >
354
351
1. If the function code for this | GeneratorExpression | is strict mode code, let _strict_ be *true* . Otherwise let _strict_ be *false* .
@@ -382,8 +379,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-generator-function-definitions-
382
379
383
380
384
381
<!-- 14.5.15 -->
385
- <emu-clause id =" sec-runtime-semantics-bindingclassdeclarationevaluation" >
386
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-runtime-semantics-bindingclassdeclarationevaluation" >14.5.15</a >) Runtime Semantics: BindingClassDeclarationEvaluation</h1 >
382
+ <emu-clause id =" proposal- sec-runtime-semantics-bindingclassdeclarationevaluation" >
383
+ <h1 >(<emu-xref href =" #sec-runtime-semantics-bindingclassdeclarationevaluation" >14.5.15</emu-xref >) Runtime Semantics: BindingClassDeclarationEvaluation</h1 >
387
384
<emu-grammar >ClassDeclaration : ` class` BindingIdentifier ClassTail </emu-grammar >
388
385
<emu-alg >
389
386
1. Let _className_ be StringValue of | BindingIdentifier | .
@@ -408,8 +405,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-runtime-semantics-bindingclassd
408
405
</emu-clause >
409
406
410
407
<!-- 14.5.16 -->
411
- <emu-clause id =" sec-class-definitions-runtime-semantics-evaluation" >
412
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-class-definitions-runtime-semantics-evaluation" >14.5.16</a >) Runtime Semantics: Evaluation</h1 >
408
+ <emu-clause id =" proposal- sec-class-definitions-runtime-semantics-evaluation" >
409
+ <h1 >(<emu-xref href =" #sec-class-definitions-runtime-semantics-evaluation" >14.5.16</emu-xref >) Runtime Semantics: Evaluation</h1 >
413
410
<emu-grammar >ClassDeclaration : ` class` BindingIdentifier ClassTail </emu-grammar >
414
411
<emu-alg >
415
412
1. Let _status_ be the result of BindingClassDeclarationEvaluation of this | ClassDeclaration | .
@@ -439,8 +436,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-class-definitions-runtime-seman
439
436
440
437
441
438
<!-- 19.2.1.1.1 -->
442
- <emu-clause id =" sec-createdynamicfunction" aoid =" CreateDynamicFunction" >
443
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-createdynamicfunction" >19.2.1.1.1</a >) Runtime Semantics: CreateDynamicFunction(_constructor_ , _newTarget_ , _kind_ , _args_ )</h1 >
439
+ <emu-clause id =" proposal- sec-createdynamicfunction" aoid =" CreateDynamicFunction" >
440
+ <h1 >(<emu-xref href =" #sec-createdynamicfunction" >19.2.1.1.1</emu-xref >) Runtime Semantics: CreateDynamicFunction( _constructor_ , _newTarget_ , _kind_ , _args_ )</h1 >
444
441
<p >The abstract operation CreateDynamicFunction is called with arguments _constructor_ , _newTarget_ , _kind_ , and _args_ . _constructor_ is the constructor function that is performing this action, _newTarget_ is the constructor that `new` was initially applied to, _kind_ is either `"normal"` or `"generator"` , and _args_ is a List containing the actual argument values that were passed to _constructor_ . The following steps are taken:</p >
445
442
<emu-alg >
446
443
1. If _newTarget_ is *undefined* , let _newTarget_ be _constructor_ .
@@ -503,8 +500,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-createdynamicfunction">19.2.1.1
503
500
504
501
505
502
<!-- 19.2.3.5 -->
506
- <emu-clause id =" sec-function.prototype.tostring" >
507
- <h1 >(<a href =" http://tc39.github.io/ecma262/ #sec-function.prototype.tostring" >19.2.3.5</a >) Function.prototype.toString( )</h1 >
503
+ <emu-clause id =" proposal- sec-function.prototype.tostring" >
504
+ <h1 >(<emu-xref href =" #sec-function.prototype.tostring" >19.2.3.5</emu-xref >) Function.prototype.toString ( )</h1 >
508
505
509
506
<p >When the `toString` method is called with an object _func_ as its *this* value, the following steps are taken:</p >
510
507
@@ -542,8 +539,8 @@ <h1>(<a href="http://tc39.github.io/ecma262/#sec-function.prototype.tostring">19
542
539
543
540
544
541
<!-- es6num="9.2.7.1" -->
545
- <emu-clause id =" sec-%throwtypeerror%" >
546
- <h1 >(<a href =" #sec-%throwtypeerror%" >9.2.7.1</a >) %ThrowTypeError% ( )</h1 >
542
+ <emu-clause id =" proposal- sec-%throwtypeerror%" >
543
+ <h1 >(<emu-xref href =" #sec-%throwtypeerror%" >9.2.7.1</emu-xref >) %ThrowTypeError% ( )</h1 >
547
544
<p >The <dfn >%ThrowTypeError%</dfn > intrinsic is a<del >n anonymous</del > built-in function object that is defined once for each realm. When %ThrowTypeError% is called it performs the following steps:</p >
548
545
<emu-alg >
549
546
1. Throw a *TypeError* exception.
0 commit comments