diff --git a/spec.html b/spec.html index adf13813ed..dac852f4eb 100644 --- a/spec.html +++ b/spec.html @@ -13449,7 +13449,7 @@

1. Perform OrdinaryCallBindThis(_F_, _calleeContext_, _thisArgument_). 1. Let _result_ be Completion(OrdinaryCallEvaluateBody(_F_, _argumentsList_)). 1. [id="step-call-pop-context-stack"] Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context. - 1. If _result_ is a return completion, return _result_.[[Value]]. + 1. If _result_ is a normal completion, return _result_.[[Value]]. 1. Assert: _result_ is a throw completion. 1. Return ? _result_. @@ -13521,7 +13521,7 @@

Runtime Semantics: EvaluateBody ( _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, - ): a return completion or a throw completion + ): a normal completion or a throw completion

@@ -13547,13 +13547,13 @@

AsyncFunctionBody : FunctionBody - 1. Return ? EvaluateAsyncFunctionBody of |AsyncFunctionBody| with arguments _functionObject_ and _argumentsList_. + 1. Return EvaluateAsyncFunctionBody of |AsyncFunctionBody| with arguments _functionObject_ and _argumentsList_. AsyncConciseBody : ExpressionBody - 1. Return ? EvaluateAsyncConciseBody of |AsyncConciseBody| with arguments _functionObject_ and _argumentsList_. + 1. Return EvaluateAsyncConciseBody of |AsyncConciseBody| with arguments _functionObject_ and _argumentsList_. Initializer : @@ -13563,11 +13563,10 @@

1. Assert: _argumentsList_ is empty. 1. Assert: _functionObject_.[[ClassFieldInitializerName]] is not ~empty~. 1. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true*, then - 1. Let _value_ be ? NamedEvaluation of |Initializer| with argument _functionObject_.[[ClassFieldInitializerName]]. + 1. Return ? NamedEvaluation of |Initializer| with argument _functionObject_.[[ClassFieldInitializerName]]. 1. Else, 1. Let _rhs_ be ? Evaluation of |AssignmentExpression|. - 1. Let _value_ be ? GetValue(_rhs_). - 1. Return ReturnCompletion(_value_). + 1. Return ? GetValue(_rhs_).

Even though field initializers constitute a function boundary, calling FunctionDeclarationInstantiation does not have any observable effect and so is omitted.

@@ -13586,7 +13585,7 @@

OrdinaryCallEvaluateBody ( _F_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, - ): a return completion or a throw completion + ): a normal completion or a throw completion

@@ -13625,7 +13624,7 @@

1. Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context. 1. If _result_ is a throw completion, then 1. Return ? _result_. - 1. Assert: _result_ is a return completion. + 1. Assert: _result_ is a normal completion. 1. If _result_.[[Value]] is an Object, return _result_.[[Value]]. 1. If _kind_ is ~base~, return _thisArgument_. 1. If _result_.[[Value]] is not *undefined*, throw a *TypeError* exception. @@ -23704,16 +23703,22 @@

Runtime Semantics: EvaluateFunctionBody ( _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, - ): a return completion or a throw completion + ): a normal completion or a throw completion

FunctionBody : FunctionStatementList 1. Perform ? FunctionDeclarationInstantiation(_functionObject_, _argumentsList_). - 1. Perform ? Evaluation of |FunctionStatementList|. + 1. Let _result_ be Completion(Evaluation of |FunctionStatementList|). 1. NOTE: If the previous step resulted in a normal completion, then evaluation finished by proceeding past the end of the |FunctionStatementList|. - 1. Return ReturnCompletion(*undefined*). + 1. If _result_ is a normal completion, then + 1. Return *undefined*. + 1. Else if _result_ is a return completion, then + 1. Return _result_.[[Value]]. + 1. Else, + 1. Assert: _result_ is a throw completion. + 1. Return ? _result_. @@ -23889,14 +23894,19 @@

Runtime Semantics: EvaluateConciseBody ( _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, - ): a return completion or a throw completion + ): a normal completion or a throw completion

ConciseBody : ExpressionBody 1. Perform ? FunctionDeclarationInstantiation(_functionObject_, _argumentsList_). - 1. Return ? Evaluation of |ExpressionBody|. + 1. Let _result_ be Completion(Evaluation of |ExpressionBody|). + 1. If _result_ is a return completion, then + 1. Return _result_.[[Value]]. + 1. Else, + 1. Assert: _result_ is a throw completion. + 1. Return ? _result_. @@ -24247,7 +24257,7 @@

Runtime Semantics: EvaluateGeneratorBody ( _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, - ): a throw completion or a return completion + ): a normal completion or a return completion

@@ -24258,7 +24268,7 @@

1. Set _G_.[[GeneratorBrand]] to ~empty~. 1. Set _G_.[[GeneratorState]] to ~suspended-start~. 1. Perform GeneratorStart(_G_, |FunctionBody|). - 1. Return ReturnCompletion(_G_). + 1. Return _G_. @@ -24474,7 +24484,7 @@

Runtime Semantics: EvaluateAsyncGeneratorBody ( _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, - ): a throw completion or a return completion + ): a normal completion or a throw completion

@@ -24487,7 +24497,7 @@

1. Set _generator_.[[GeneratorBrand]] to ~empty~. 1. Set _generator_.[[AsyncGeneratorState]] to ~suspended-start~. 1. Perform AsyncGeneratorStart(_generator_, |FunctionBody|). - 1. Return ReturnCompletion(_generator_). + 1. Return _generator_. @@ -25096,7 +25106,7 @@

Runtime Semantics: EvaluateClassStaticBlockBody ( _functionObject_: an ECMAScript function object, - ): a return completion or a throw completion + ): a normal completion or a throw completion

@@ -25105,7 +25115,7 @@

1. Assert: _functionObject_ is a synthetic function created by ClassStaticBlockDefinitionEvaluation step . 1. Perform ! FunctionDeclarationInstantiation(_functionObject_, « »). 1. Perform ? Evaluation of |ClassStaticBlockStatementList|. - 1. Return ReturnCompletion(*undefined*). + 1. Return *undefined*. @@ -25490,7 +25500,7 @@

Runtime Semantics: EvaluateAsyncFunctionBody ( _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, - ): a return completion + ): a Promise

@@ -25504,7 +25514,7 @@

1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _completion_.[[Value]] »). 1. Else, 1. Perform AsyncFunctionStart(_promiseCapability_, |FunctionBody|). - 1. Return ReturnCompletion(_promiseCapability_.[[Promise]]). + 1. Return _promiseCapability_.[[Promise]]. @@ -25597,7 +25607,7 @@

Runtime Semantics: EvaluateAsyncConciseBody ( _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, - ): a return completion + ): a Promise

@@ -25611,7 +25621,7 @@

1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _completion_.[[Value]] »). 1. Else, 1. Perform AsyncFunctionStart(_promiseCapability_, |ExpressionBody|). - 1. Return ReturnCompletion(_promiseCapability_.[[Promise]]). + 1. Return _promiseCapability_.[[Promise]]. @@ -36361,7 +36371,7 @@

String.prototype [ %Symbol.iterator% ] ( )

1. Let _resultString_ be the substring of _s_ from _position_ to _nextIndex_. 1. Set _position_ to _nextIndex_. 1. Perform ? GeneratorYield(CreateIteratorResultObject(_resultString_, *false*)). - 1. Return *undefined*. + 1. Return NormalCompletion(*undefined*). 1. Return CreateIteratorFromClosure(_closure_, *"%StringIteratorPrototype%"*, %StringIteratorPrototype%).

The value of the *"name"* property of this method is *"[Symbol.iterator]"*.

@@ -43308,7 +43318,7 @@

1. Perform ? GeneratorYield(CreateIteratorResultObject(_result_, *false*)). 1. NOTE: The number of elements in _entries_ may have increased while execution of this abstract operation was paused by GeneratorYield. 1. Set _numEntries_ to the number of elements in _entries_. - 1. Return *undefined*. + 1. Return NormalCompletion(*undefined*). 1. Return CreateIteratorFromClosure(_closure_, *"%MapIteratorPrototype%"*, %MapIteratorPrototype%). @@ -43938,7 +43948,7 @@

1. Perform ? GeneratorYield(CreateIteratorResultObject(_e_, *false*)). 1. NOTE: The number of elements in _entries_ may have increased while execution of this abstract operation was paused by GeneratorYield. 1. Set _numEntries_ to the number of elements in _entries_. - 1. Return *undefined*. + 1. Return NormalCompletion(*undefined*). 1. Return CreateIteratorFromClosure(_closure_, *"%SetIteratorPrototype%"*, %SetIteratorPrototype%). @@ -47822,10 +47832,10 @@

Iterator.prototype.drop ( _limit_ )

1. If _remaining_ ≠ +∞, then 1. Set _remaining_ to _remaining_ - 1. 1. Let _next_ be ? IteratorStep(_iterated_). - 1. If _next_ is ~done~, return ReturnCompletion(*undefined*). + 1. If _next_ is ~done~, return NormalCompletion(*undefined*). 1. Repeat, 1. Let _value_ be ? IteratorStepValue(_iterated_). - 1. If _value_ is ~done~, return ReturnCompletion(*undefined*). + 1. If _value_ is ~done~, return NormalCompletion(*undefined*). 1. Let _completion_ be Completion(Yield(_value_)). 1. IfAbruptCloseIterator(_completion_, _iterated_). 1. Let _result_ be CreateIteratorFromClosure(_closure_, *"Iterator Helper"*, %IteratorHelperPrototype%, « [[UnderlyingIterator]] »). @@ -47871,7 +47881,7 @@

Iterator.prototype.filter ( _predicate_ )

1. Let _counter_ be 0. 1. Repeat, 1. Let _value_ be ? IteratorStepValue(_iterated_). - 1. If _value_ is ~done~, return ReturnCompletion(*undefined*). + 1. If _value_ is ~done~, return NormalCompletion(*undefined*). 1. Let _selected_ be Completion(Call(_predicate_, *undefined*, « _value_, 𝔽(_counter_) »)). 1. IfAbruptCloseIterator(_selected_, _iterated_). 1. If ToBoolean(_selected_) is *true*, then @@ -47921,7 +47931,7 @@

Iterator.prototype.flatMap ( _mapper_ )

1. Let _counter_ be 0. 1. Repeat, 1. Let _value_ be ? IteratorStepValue(_iterated_). - 1. If _value_ is ~done~, return ReturnCompletion(*undefined*). + 1. If _value_ is ~done~, return NormalCompletion(*undefined*). 1. Let _mapped_ be Completion(Call(_mapper_, *undefined*, « _value_, 𝔽(_counter_) »)). 1. IfAbruptCloseIterator(_mapped_, _iterated_). 1. Let _innerIterator_ be Completion(GetIteratorFlattenable(_mapped_, ~reject-primitives~)). @@ -47981,7 +47991,7 @@

Iterator.prototype.map ( _mapper_ )

1. Let _counter_ be 0. 1. Repeat, 1. Let _value_ be ? IteratorStepValue(_iterated_). - 1. If _value_ is ~done~, return ReturnCompletion(*undefined*). + 1. If _value_ is ~done~, return NormalCompletion(*undefined*). 1. Let _mapped_ be Completion(Call(_mapper_, *undefined*, « _value_, 𝔽(_counter_) »)). 1. IfAbruptCloseIterator(_mapped_, _iterated_). 1. Let _completion_ be Completion(Yield(_mapped_)). @@ -48064,11 +48074,11 @@

Iterator.prototype.take ( _limit_ )

1. Let _remaining_ be _integerLimit_. 1. Repeat, 1. If _remaining_ = 0, then - 1. Return ? IteratorClose(_iterated_, ReturnCompletion(*undefined*)). + 1. Return ? IteratorClose(_iterated_, NormalCompletion(*undefined*)). 1. If _remaining_ ≠ +∞, then 1. Set _remaining_ to _remaining_ - 1. 1. Let _value_ be ? IteratorStepValue(_iterated_). - 1. If _value_ is ~done~, return ReturnCompletion(*undefined*). + 1. If _value_ is ~done~, return NormalCompletion(*undefined*). 1. Let _completion_ be Completion(Yield(_value_)). 1. IfAbruptCloseIterator(_completion_, _iterated_). 1. Let _result_ be CreateIteratorFromClosure(_closure_, *"Iterator Helper"*, %IteratorHelperPrototype%, « [[UnderlyingIterator]] »). @@ -49806,16 +49816,22 @@

1. Let _acGenerator_ be the Generator component of _acGenContext_. 1. If _generatorBody_ is a Parse Node, then 1. Let _result_ be Completion(Evaluation of _generatorBody_). + 1. If _result_ is a normal completion, then + 1. NOTE: This implies that evaluation finished without reaching an explicit |ReturnStatement|. + 1. Set _result_ to NormalCompletion(*undefined*). + 1. Else if _result_ is a return completion, then + 1. Set _result_ to NormalCompletion(_result_.[[Value]]). + 1. Else, + 1. Assert: _result_ is a throw completion. 1. Else, 1. Assert: _generatorBody_ is an Abstract Closure with no parameters. 1. Let _result_ be Completion(_generatorBody_()). + 1. Assert: _result_ is a normal completion or a throw completion. 1. Assert: If we return here, the generator either threw an exception or performed either an implicit or explicit return. 1. Remove _acGenContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. 1. Set _acGenerator_.[[GeneratorState]] to ~completed~. 1. NOTE: Once a generator enters the ~completed~ state it never leaves it and its associated execution context is never resumed. Any execution state associated with _acGenerator_ can be discarded at this point. 1. If _result_ is a normal completion, then - 1. Let _resultValue_ be *undefined*. - 1. Else if _result_ is a return completion, then 1. Let _resultValue_ be _result_.[[Value]]. 1. Else, 1. Assert: _result_ is a throw completion. @@ -50170,14 +50186,20 @@

1. Let _acGenerator_ be the Generator component of _acGenContext_. 1. If _generatorBody_ is a Parse Node, then 1. Let _result_ be Completion(Evaluation of _generatorBody_). + 1. If _result_ is a normal completion, then + 1. NOTE: This implies that evaluation finished without reaching an explicit |ReturnStatement|. + 1. Set _result_ to NormalCompletion(*undefined*). + 1. Else if _result_ is a return completion, then + 1. Set _result_ to NormalCompletion(_result_.[[Value]]). + 1. Else, + 1. Assert: _result_ is a throw completion. 1. Else, 1. Assert: _generatorBody_ is an Abstract Closure with no parameters. 1. Let _result_ be Completion(_generatorBody_()). + 1. Assert: _result_ is a normal completion or a throw completion. 1. Assert: If we return here, the async generator either threw an exception or performed either an implicit or explicit return. 1. Remove _acGenContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. 1. Set _acGenerator_.[[AsyncGeneratorState]] to ~draining-queue~. - 1. If _result_ is a normal completion, set _result_ to NormalCompletion(*undefined*). - 1. If _result_ is a return completion, set _result_ to NormalCompletion(_result_.[[Value]]). 1. Perform AsyncGeneratorCompleteStep(_acGenerator_, _result_, *true*). 1. Perform AsyncGeneratorDrainQueue(_acGenerator_). 1. Return *undefined*. @@ -50561,15 +50583,21 @@

1. Let _acAsyncContext_ be the running execution context. 1. If _asyncBody_ is a Parse Node, then 1. Let _result_ be Completion(Evaluation of _asyncBody_). + 1. If _result_ is a normal completion, then + 1. NOTE: This implies that evaluation finished without reaching an explicit |ReturnStatement|. + 1. Set _result_ to NormalCompletion(*undefined*). + 1. Else if _result_ is a return completion, then + 1. Set _result_ to NormalCompletion(_result_.[[Value]]). + 1. Else, + 1. Assert: _result_ is a return completion. 1. Else, 1. Assert: _asyncBody_ is an Abstract Closure with no parameters. - 1. Let _result_ be _asyncBody_(). + 1. Let _result_ be Completion(_asyncBody_()). + 1. Assert: _result_ is a normal completion or a throw completion. 1. Assert: If we return here, the async function either threw an exception or performed an implicit or explicit return; all awaiting is done. 1. Remove _acAsyncContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. 1. If _result_ is a normal completion, then - 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « *undefined* »). - 1. Else if _result_ is a return completion, then - 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _result_.[[Value]] »). + 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _result_.[[Value]] »). 1. Else, 1. Assert: _result_ is a throw completion. 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _result_.[[Value]] »).