From 3abf56efa8524eb074d5e9ffa8339474f713241b Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Sat, 17 Jul 2021 22:12:53 -0700 Subject: [PATCH] Editorial: Inline "Dynamic Function SourceText Prefixes" table (#2367) ... into the if-else cascade in CreateDynamicFunction, suggested in https://github.com/tc39/ecma262/pull/2348#discussion_r606347643 --- spec.html | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/spec.html b/spec.html index 31c00353221..e020b33dbdc 100644 --- a/spec.html +++ b/spec.html @@ -28411,7 +28411,7 @@

Function ( _p1_, _p2_, … , _pn_, _body_ )

- +

CreateDynamicFunction ( _constructor_: a constructor, @@ -28432,22 +28432,26 @@

1. Perform ? HostEnsureCanCompileStrings(_callerRealm_, _calleeRealm_). 1. If _newTarget_ is *undefined*, set _newTarget_ to _constructor_. 1. If _kind_ is ~normal~, then + 1. Let _prefix_ be *"function"*. 1. Let _exprSym_ be the grammar symbol |FunctionExpression|. 1. Let _bodySym_ be the grammar symbol |FunctionBody[~Yield, ~Await]|. 1. Let _parameterSym_ be the grammar symbol |FormalParameters[~Yield, ~Await]|. 1. Let _fallbackProto_ be *"%Function.prototype%"*. 1. Else if _kind_ is ~generator~, then + 1. Let _prefix_ be *"function\*"*. 1. Let _exprSym_ be the grammar symbol |GeneratorExpression|. 1. Let _bodySym_ be the grammar symbol |GeneratorBody|. 1. Let _parameterSym_ be the grammar symbol |FormalParameters[+Yield, ~Await]|. 1. Let _fallbackProto_ be *"%GeneratorFunction.prototype%"*. 1. Else if _kind_ is ~async~, then + 1. Let _prefix_ be *"async function"*. 1. Let _exprSym_ be the grammar symbol |AsyncFunctionExpression|. 1. Let _bodySym_ be the grammar symbol |AsyncFunctionBody|. 1. Let _parameterSym_ be the grammar symbol |FormalParameters[~Yield, +Await]|. 1. Let _fallbackProto_ be *"%AsyncFunction.prototype%"*. 1. Else, 1. Assert: _kind_ is ~asyncGenerator~. + 1. Let _prefix_ be *"async function\*"*. 1. Let _exprSym_ be the grammar symbol |AsyncGeneratorExpression|. 1. Let _bodySym_ be the grammar symbol |AsyncGeneratorBody|. 1. Let _parameterSym_ be the grammar symbol |FormalParameters[+Yield, +Await]|. @@ -28468,7 +28472,6 @@

1. Set _k_ to _k_ + 1. 1. Let _bodyArg_ be _args_[_k_]. 1. Let _bodyString_ be the string-concatenation of 0x000A (LINE FEED), ? ToString(_bodyArg_), and 0x000A (LINE FEED). - 1. Let _prefix_ be the prefix associated with _kind_ in . 1. Let _sourceString_ be the string-concatenation of _prefix_, *" anonymous("*, _P_, 0x000A (LINE FEED), *") {"*, _bodyString_, and *"}"*. 1. Let _sourceText_ be ! StringToCodePoints(_sourceString_). 1. Let _parameters_ be ParseText(! StringToCodePoints(_P_), _parameterSym_). @@ -28498,18 +28501,6 @@

CreateDynamicFunction defines a *"prototype"* property on any function it creates whose _kind_ is not ~async~ to provide for the possibility that the function will be used as a constructor.

- - - - - - - - - - -
KindPrefix
~normal~*"function"*
~generator~*"function\*"*
~async~*"async function"*
~asyncGenerator~*"async function\*"*
-