diff --git a/spec/generator-abstract-ops-patch.html b/spec/generator-abstract-ops-patch.html index b3d7716..e1fa660 100644 --- a/spec/generator-abstract-ops-patch.html +++ b/spec/generator-abstract-ops-patch.html @@ -2,7 +2,7 @@

GetGeneratorKind ( )

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~. diff --git a/spec/index.html b/spec/index.html index 618acf0..2144bd0 100644 --- a/spec/index.html +++ b/spec/index.html @@ -17,6 +17,12 @@

Introduction

+ +

ECMAScript Language: Statements and Declarations

+ + +
+

ECMAScript Language: Functions and Classes

diff --git a/spec/statements-and-declarations-patch.html b/spec/statements-and-declarations-patch.html new file mode 100644 index 0000000..ddb6e62 --- /dev/null +++ b/spec/statements-and-declarations-patch.html @@ -0,0 +1,28 @@ + +

The `return` Statement

+

Syntax

+ + ReturnStatement[Yield, Await] : + `return` `;` + `return` [no LineTerminator here] Expression[+In, ?Yield, ?Await] `;` + + +

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|.

+
+ + + +

Runtime Semantics: Evaluation

+ ReturnStatement : `return` `;` + + 1. Return Completion{[[Type]]: ~return~, [[Value]]: *undefined*, [[Target]]: ~empty~}. + + ReturnStatement : `return` Expression `;` + + 1. Let _exprRef_ be the result of evaluating |Expression|. + 1. Let _exprValue_ be ? GetValue(_exprRef_). + 1. If ! GetGeneratorKind() is ~async~, set _exprValue_ to ? Await(_exprValue_). + 1. Return Completion{[[Type]]: ~return~, [[Value]]: _exprValue_, [[Target]]: ~empty~}. + +
+