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

Commit

Permalink
Tweak return statements instead
Browse files Browse the repository at this point in the history
  • Loading branch information
domenic committed Jun 6, 2017
1 parent 79f698b commit 3c1d60f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spec/generator-abstract-ops-patch.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1><ins>GetGeneratorKind ( )</ins></h1>
<emu-alg>
1. Let _genContext_ be the running execution context.
1. Assert: _genContext_ has a Generator component.
1. If _genContext_ does not have a Generator component, return ~non-generator~.
1. Let _generator_ be the Generator component of _genContext_.
1. If _generator_ has an [[AsyncGeneratorState]] internal slot, return ~async~.
1. Else, return ~normal~.
Expand Down
6 changes: 6 additions & 0 deletions spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ <h1>Introduction</h1>
<emu-import href="./introduction.html"></emu-import>
</emu-clause>

<emu-clause id="sec-ecmascript-language-functions-and-classes">
<h1>ECMAScript Language: Statements and Declarations</h1>

<emu-import href="./statements-and-declarations-patch.html"></emu-import>
</emu-clause>

<emu-clause id="sec-ecmascript-language-functions-and-classes">
<h1>ECMAScript Language: Functions and Classes</h1>

Expand Down
28 changes: 28 additions & 0 deletions spec/statements-and-declarations-patch.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<emu-clause id="sec-return-statement">
<h1>The `return` Statement</h1>
<h2>Syntax</h2>
<emu-grammar>
ReturnStatement[Yield, Await] :
`return` `;`
`return` [no LineTerminator here] Expression[+In, ?Yield, ?Await] `;`
</emu-grammar>
<emu-note>
<p>A `return` statement causes a function to cease execution and return a value to the caller. If |Expression| is omitted, the return value is *undefined*. Otherwise, the return value is the value of |Expression|.</p>
</emu-note>

<!-- es6num="13.10.1" -->
<emu-clause id="sec-return-statement-runtime-semantics-evaluation">
<h1>Runtime Semantics: Evaluation</h1>
<emu-grammar>ReturnStatement : `return` `;`</emu-grammar>
<emu-alg>
1. Return Completion{[[Type]]: ~return~, [[Value]]: *undefined*, [[Target]]: ~empty~}.
</emu-alg>
<emu-grammar>ReturnStatement : `return` Expression `;`</emu-grammar>
<emu-alg>
1. Let _exprRef_ be the result of evaluating |Expression|.
1. Let _exprValue_ be ? GetValue(_exprRef_).
1. <ins>If ! GetGeneratorKind() is ~async~, set _exprValue_ to ? Await(_exprValue_).</ins>
1. Return Completion{[[Type]]: ~return~, [[Value]]: _exprValue_, [[Target]]: ~empty~}.
</emu-alg>
</emu-clause>
</emu-clause>

0 comments on commit 3c1d60f

Please sign in to comment.