com php-langspec: Merge branch 'pull-request/137': spec/10-expressions.md
[email protected] (Stanislav Malyshev) Sat, 02 Jan 2016 01:51:33 +0000
| Newsgroups | php.standards.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 79d439a0ee598761a246cf9bb9ff1521089a7c64 Author: Stanislav Malyshev <[email protected]> Fri, 1 Jan 2016 17:50:22 -0800 Parents: 5154ca3ed053047ab2a6679a31dbda79a985b4d4 5d3978abe315b73ba5cafdf10bad8ab1d93e2c57 Branches: master Link: http://git.php.net/?p=php-langspec.git;a=commitdiff;h=79d439a0ee598761a246cf9bb9ff1521089a7c64 Log: Merge branch 'pull-request/137' Changed paths: MM spec/10-expressions.md Diff: diff --cc spec/10-expressions.md index 62a2e43,d1fa842..97af190 --- a/spec/10-expressions.md +++ b/spec/10-expressions.md @@@ -2978,6 -2984,20 +2980,20 @@@ used and each value is `NULL` If the generator function definition declares that it returns byRef, each value in a key/value pair is yielded byRef. + The following applies only to the `yield from` form: + + A generator function (referred to as a *delegating generator*) can delegate to another generator function (referred to as a *subgenerator*), a Traversable object, or an array, each of which is designated by *expression*. + + Each value yielded by *expression* is passed directly to the delegating generator's caller. + + Each value sent to the delegating generator's `send` method is passed to the subgenerator's `send` method. If *expression* is not a generator function, any sent values are ignored. + + Exceptions thrown by *expression* are propagated up to the delegating generator. + + Upon traversable completion, `NULL` is returned to the delegating generator if the traversable is not a generator. If the traversable is a generator, its return value is sent to the delegating generator as the value of the `yield from` *expression*. + -An exception of type `EngineException` is thrown if *expression* evaluates to a generator that previously terminated with an uncaught exception, or it evaluates to something that is neither Traversable nor an array. ++An exception of type `Error` is thrown if *expression* evaluates to a generator that previously terminated with an uncaught exception, or it evaluates to something that is neither Traversable nor an array. + **Examples** ```PHP