Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit b2815d8

Browse files
save source text for more async functions and methods
1 parent 3fb47c6 commit b2815d8

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

proposal.html

+78
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,84 @@ <h1>(<emu-xref href="#sec-class-definitions-runtime-semantics-evaluation">14.5.1
542542
</emu-clause>
543543

544544

545+
<!-- 14.7.12 -->
546+
<emu-clause id="proposal-sec-async-function-definitions-PropertyDefinitionEvaluation">
547+
<h1>(<emu-xref href="sec-async-function-definitions-PropertyDefinitionEvaluation">14.7.12</emu-xref>) Runtime Semantics: PropertyDefinitionEvaluation</h1>
548+
<p>With parameters _object_ and _enumerable_.</p>
549+
<emu-grammar>
550+
AsyncMethod : `async` [no LineTerminator here] PropertyName `(` UniqueFormalParameters `)` `{` AsyncFunctionBody `}`
551+
</emu-grammar>
552+
<emu-alg>
553+
1. Let _propKey_ be the result of evaluating |PropertyName|.
554+
1. ReturnIfAbrupt(_propKey_).
555+
1. If the function code for this |AsyncMethod| is strict mode code, let _strict_ be *true*. Otherwise let _strict_ be *false*.
556+
1. Let _scope_ be the LexicalEnvironment of the running execution context.
557+
1. Let _closure_ be ! AsyncFunctionCreate(~Method~, |UniqueFormalParameters|, |AsyncFunctionBody|, _scope_, _strict_).
558+
1. Perform ! MakeMethod(_closure_, _object_).
559+
1. Perform ! SetFunctionName(_closure_, _propKey_).
560+
1. <ins>Set _closure_.[[SourceText]] to the source text matched by |AsyncMethod|.</ins>
561+
1. Let _desc_ be the PropertyDescriptor{[[Value]]: _closure_, [[Writable]]: *true*, [[Enumerable]]: _enumerable_, [[Configurable]]: *true*}.
562+
1. Return ? DefinePropertyOrThrow(_object_, _propKey_, _desc_).
563+
</emu-alg>
564+
</emu-clause>
565+
566+
567+
<!-- 14.7.13 -->
568+
<emu-clause id="proposal-sec-async-function-definitions-runtime-semantics-evaluation">
569+
<h1>(<emu-xref href="sec-async-function-definitions-runtime-semantics-evaluation">14.7.13</emu-xref>) Runtime Semantics: Evaluation</h1>
570+
<emu-grammar>
571+
AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
572+
</emu-grammar>
573+
<emu-alg>
574+
1. Return NormalCompletion(~empty~).
575+
</emu-alg>
576+
577+
<emu-grammar>
578+
AsyncFunctionDeclaration : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
579+
</emu-grammar>
580+
<emu-alg>
581+
1. Return NormalCompletion(~empty~).
582+
</emu-alg>
583+
584+
<emu-grammar>
585+
AsyncFunctionExpression : `async` [no LineTerminator here] `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
586+
</emu-grammar>
587+
<emu-alg>
588+
1. If the function code for |AsyncFunctionExpression| is strict mode code, let _strict_ be *true*. Otherwise let _strict_ be *false*.
589+
1. Let _scope_ be the LexicalEnvironment of the running execution context.
590+
1. Let _closure_ be ! AsyncFunctionCreate(~Normal~, |FormalParameters|, |AsyncFunctionBody|, _scope_, _strict_).
591+
1. <ins>Set _closure_.[[SourceText]] to the source text matched by |AsyncFunctionExpression|.</ins>
592+
1. Return _closure_.
593+
</emu-alg>
594+
595+
<emu-grammar>
596+
AsyncFunctionExpression : `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)` `{` AsyncFunctionBody `}`
597+
</emu-grammar>
598+
<emu-alg>
599+
1. If the function code for |AsyncFunctionExpression| is strict mode code, let _strict_ be *true*. Otherwise let _strict_ be *false*.
600+
1. Let _scope_ be the LexicalEnvironment of the running execution context.
601+
1. Let _funcEnv_ be ! NewDeclarativeEnvironment(_scope_).
602+
1. Let _envRec_ be _funcEnv_'s EnvironmentRecord.
603+
1. Let _name_ be StringValue of |BindingIdentifier|.
604+
1. Perform ! _envRec_.CreateImmutableBinding(_name_).
605+
1. Let _closure_ be ! AsyncFunctionCreate(~Normal~, |FormalParameters|, |AsyncFunctionBody|, _funcEnv_, _strict_).
606+
1. Perform ! SetFunctionName(_closure_, _name_).
607+
1. Perform ! _envRec_.InitializeBinding(_name_, _closure_).
608+
1. <ins>Set _closure_.[[SourceText]] to the source text matched by |AsyncFunctionExpression|.</ins>
609+
1. Return _closure_.
610+
</emu-alg>
611+
612+
<emu-grammar>
613+
AwaitExpression : `await` UnaryExpression
614+
</emu-grammar>
615+
<emu-alg>
616+
1. Let _exprRef_ be the result of evaluating |UnaryExpression|.
617+
1. Let _value_ be ? GetValue(_exprRef_).
618+
1. Return ? Await(_value_).
619+
</emu-alg>
620+
</emu-clause>
621+
622+
545623
<!-- es6num="19.2.1.1.1" -->
546624
<emu-clause id="proposal-sec-createdynamicfunction" aoid="CreateDynamicFunction">
547625
<h1>(<emu-xref href="#sec-createdynamicfunction">19.2.1.1.1</emu-xref>) Runtime Semantics: CreateDynamicFunction( _constructor_, _newTarget_, _kind_, _args_ )</h1>

0 commit comments

Comments
 (0)