Revision tags: php-5.4.6RC1 |
|
#
13408937 |
| 22-Jul-2012 |
Nikita Popov |
Throw error also for return occuring before yield Previously only an error was thrown when return occured after yield. Also returns before the first yield would fail for by-ref generator
Throw error also for return occuring before yield Previously only an error was thrown when return occured after yield. Also returns before the first yield would fail for by-ref generators. Now the error message is handled in pass_two, so all returns are checked.
show more ...
|
#
de80e3ce |
| 22-Jul-2012 |
Nikita Popov |
Remove reference restrictions from foreach foreach only allowed variables to be traversed by reference. This never really made sense because a) Expressions like array(&$a, &
Remove reference restrictions from foreach foreach only allowed variables to be traversed by reference. This never really made sense because a) Expressions like array(&$a, &$b) can be meaningfully iterated by-ref b) Function calls can return by-ref (so they can also be meaningfully iterated) c) Iterators could at least in theory also be iterated by-ref (not sure if any iterator makes use of this) With by-ref generators the restriction makes even less sense, so I removed it altogether.
show more ...
|
#
80748631 |
| 21-Jul-2012 |
Nikita Popov |
Require parenthesis around yield expressions If yield is used in an expression context parenthesis are now required. This ensures that the code is unambiguos. Yield statements c
Require parenthesis around yield expressions If yield is used in an expression context parenthesis are now required. This ensures that the code is unambiguos. Yield statements can still be used without parenthesis (which should be the most common case). Also yield expressions without value can be used without parenthesis, too (this should be the most common case for coroutines). If the yield expression is used in a context where parenthesis are required anyway, no additional parenthesis have to be inserted. Examples: // Statements don't need parenthesis yield $foo; yield $foo => $bar; // Yield without value doesn't need parenthesis either $data = yield; // Parentheses don't have to be duplicated foo(yield $bar); if (yield $bar) { ... } // But we have to use parentheses here $foo = (yield $bar); This commit also fixes an issue with by-ref passing of $foo[0] like variables. They previously weren't properly fetched for write. Additionally this fixes valgrind warnings which were caused by access to uninitialized memory in zend_is_function_or_method_call().
show more ...
|
#
c9709bfb |
| 19-Jul-2012 |
Nikita Popov |
Remove asterix modifier (*) for generators Generators are now automatically detected by the presence of a `yield` expression in their body. This removes the ZEND_SUSPEND_AND_RET
Remove asterix modifier (*) for generators Generators are now automatically detected by the presence of a `yield` expression in their body. This removes the ZEND_SUSPEND_AND_RETURN_GENERATOR opcode. Instead additional checks for ZEND_ACC_GENERATOR are added to the fcall_common helper and zend_call_function. This also adds a new function zend_generator_create_zval, which handles the actual creation of the generator zval from an op array. I feel like I should deglobalize the zend_create_execute_data_from_op_array code a bit. It currently changes EG(current_execute_data) and EG(opline_ptr) which is somewhat confusing (given the name).
show more ...
|
Revision tags: php-5.4.5 |
|
#
85f077ce |
| 17-Jul-2012 |
Nikita Popov |
Add support by yielding by-reference
|
Revision tags: php-5.3.15, php-5.3.15RC1, php-5.4.5RC1, php-5.3.14, php-5.4.4 |
|
#
896ac689 |
| 11-Jun-2012 |
Marc Easen |
Fixed the common misspelling of the word occurred (occured -> occurred)
|
#
d939d2de |
| 11-Jun-2012 |
Nikita Popov |
Add sceleton for yield* expression This does not yet actually implement any delegation.
|
#
d1debecd |
| 08-Jun-2012 |
Stanislav Malyshev |
typo
|
#
ba8333cd |
| 08-Jun-2012 |
Stanislav Malyshev |
typo
|
#
17c0ff11 |
| 08-Jun-2012 |
Stanislav Malyshev |
typo
|
Revision tags: php-5.3.14RC2, php-5.4.4RC2 |
|
#
bc08c2cf |
| 30-May-2012 |
Nikita Popov |
Add support for yielding keys Keys are yielded using the yield $key => $value syntax. Currently this is implemented as a statement only and not as an expression, be
Add support for yielding keys Keys are yielded using the yield $key => $value syntax. Currently this is implemented as a statement only and not as an expression, because conflicts arise considering nesting and use in arrays: yield yield $a => $b; // could be either yield (yield $a) => $b; // or yield (yield $a => $b); Once I find some way to resolve these conflicts this should be available as an expression too. Also the key yielding code is rather copy-and-past-y for the value yielding code, so that should be factored out.
show more ...
|
#
ad525c28 |
| 29-May-2012 |
Nikita Popov |
Allow to use yield without value If the generator is used as a coroutine it often doesn't make sense to yield anything. In this case one can simply receive values using $val
Allow to use yield without value If the generator is used as a coroutine it often doesn't make sense to yield anything. In this case one can simply receive values using $value = yield; The yield here will simply yield NULL.
show more ...
|
#
3600914c |
| 29-May-2012 |
Nikita Popov |
Add support for $generator->send() Yield now is an expression and the return value is the value passed to $generator->send(). By default (i.e. if ->next() is called) the value is NUL
Add support for $generator->send() Yield now is an expression and the return value is the value passed to $generator->send(). By default (i.e. if ->next() is called) the value is NULL. Unlike in Python ->send() can be run without priming the generator with a ->next() call first.
show more ...
|
#
5bb3a995 |
| 26-May-2012 |
Nikita Popov |
Implement return for generators For generators ZEND_RETURN directly calls ZEND_VM_RETURN(), thus passing execution back to the caller (zend_generator_resume). This commit also a
Implement return for generators For generators ZEND_RETURN directly calls ZEND_VM_RETURN(), thus passing execution back to the caller (zend_generator_resume). This commit also adds a check that only return; is used in generators and not return $value;.
show more ...
|
#
fafce586 |
| 26-May-2012 |
Nikita Popov |
Add YIELD opcode implementation
|
#
bbcea230 |
| 21-May-2012 |
Xinchen Hui |
Use emalloc instead of malloc
|
#
2ae8d2fb |
| 21-May-2012 |
Dmitry Stogov |
Fixed bug #61998 (Using traits with method aliases appears to result in crash during execution)
|
#
1cec3f12 |
| 19-May-2012 |
Nikita Popov |
Add ZEND_SUSPEND_AND_RETURN_GENERATOR opcode If the function is a generator this opcode will be invoked right after receiving the function arguments. The current implementation
Add ZEND_SUSPEND_AND_RETURN_GENERATOR opcode If the function is a generator this opcode will be invoked right after receiving the function arguments. The current implementation is just a dummy.
show more ...
|
#
e14cfafc |
| 19-May-2012 |
Nikita Popov |
Add zend_do_suspend_if_generator calls The execution of generator functions will be suspended right after the arguments were RECVed. This will be done in zend_do_suspend_if_generator.
|
#
fd2a109f |
| 19-May-2012 |
Nikita Popov |
Add error if yield is used outside a generator The yield statement can only be used in generator functions, which are marked with an asterix.
|
#
9b51a3b9 |
| 19-May-2012 |
Nikita Popov |
Minor code cleanup The block for the foreach separator was nested unnecessary. This commit simply removes that nesting.
|
#
252f6234 |
| 19-May-2012 |
Nikita Popov |
Add flag for generator functions Generator functions have to specify the * (asterix) modifier after the function keyword. If they do so the ZEND_ACC_GENERATOR flag is added to the fn
Add flag for generator functions Generator functions have to specify the * (asterix) modifier after the function keyword. If they do so the ZEND_ACC_GENERATOR flag is added to the fn_flags.
show more ...
|
Revision tags: php-5.3.14RC1, php-5.4.4RC1 |
|
#
9b101ac8 |
| 15-May-2012 |
Nikita Popov |
Add T_YIELD "yield" keyword
|
Revision tags: php-5.3.13, php-5.4.3, php-5.4.2, php-5.3.12, php-5.3.11, php-5.4.1 |
|
#
ec061a93 |
| 12-Apr-2012 |
Nikita Popov |
Allow arbitrary expressions for empty() This change is as per RFC https://wiki.php.net/rfc/empty_isset_exprs. The change allows passing the result of function calls and other ex
Allow arbitrary expressions for empty() This change is as per RFC https://wiki.php.net/rfc/empty_isset_exprs. The change allows passing the result of function calls and other expressions to the empty() language construct. This is accomplished by simply rewriting empty(expr) to !expr. The change does not affect the suppression of errors when using empty() on variables. empty($undefinedVar) will continue not to throw errors. When an expression is used inside empty() on the other hand, errors will not be suppressed. Thus empty($undefinedVar + $somethingElse) *will* throw a notice. The change also does not make empty() into a real function, so using 'empty' as a callback is still not possible. In addition to the empty() changes the commit adds nicer error messages when isset() is used on function call results or other expressions.
show more ...
|
#
da6465a2 |
| 18-Apr-2012 |
Xinchen Hui |
Fixed bug #61761 ('Overriding' a private static method with a different signature causes crash)
|