summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
Commit message (Collapse)AuthorAgeFilesLines
...
| * | Fixed compiler reenterabilityDmitry Stogov2012-11-141-0/+1
| | |
* | | Merge branch 'PHP-5.4'Xinchen Hui2012-10-231-2/+2
|\ \ \ | |/ /
| * | Fixed bug #63305 (zend_mm_heap corrupted with traits)Xinchen Hui2012-10-231-2/+2
| | |
* | | Merge branch 'PHP-5.4'Xinchen Hui2012-10-081-4/+10
|\ \ \ | |/ /
| * | Fixed bug #63219 (Segfault when aliasing trait method when autoloader throws ↵Xinchen Hui2012-10-081-4/+10
| | | | | | | | | | | | excpetion)
* | | Merge branch 'PHP-5.4'Dmitry Stogov2012-09-051-3/+4
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | * PHP-5.4: Fixed bug #62907 (Double free when use traits) Conflicts: NEWS
| * | Fixed bug #62907 (Double free when use traits)Dmitry Stogov2012-09-051-3/+4
| | |
| * | Bug #62956: fixing private method signature validationLars Strojny2012-08-281-0/+5
| | | | | | | | | | | | | | | In inheritance, if both methods are private, don not enforce the same signature.
* | | Merge branch 'generators'Gustavo Lopes2012-09-011-13/+58
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generators: (70 commits) Fix typos Fix segfault when traversing a by-ref generator twice Make sure that exception is thrown on rewind() after closing too Remove implementation stubs for yield delegation Fix several issues and allow rewind only at/before first yield Run finally if generator is closed before finishing Finally with return now works in generators too Add dedicated opcode for returns from a generator Disallow serialization and unserialization Fix zts build (typo) Drop Generator::close() method Forgot to add test Support trivial finally in generators (no yield, no return) Fix implementation of Iterator interface Add T_YIELD in tokenizer_data.c Throw error also for return occuring before yield Fix throwing of exceptions within a generator Remove reference restrictions from foreach Require parenthesis around yield expressions Add some more tests ...
| * \ \ Merge remote-tracking branch 'php-src/master' into addGeneratorsSupportNikita Popov2012-08-261-6/+11
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Zend/zend_language_parser.y Zend/zend_vm_execute.skl
| * | | | Remove implementation stubs for yield delegationNikita Popov2012-08-251-23/+0
| | | | | | | | | | | | | | | | | | | | | | | | | I decided to leave out yield delegation for an initial proposal, so remove the stubs for it too.
| * | | | Merge remote-tracking branch 'php-src/master' into addGeneratorsSupportNikita Popov2012-08-241-13/+17
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Zend/zend_vm_def.h Zend/zend_vm_execute.h
| * \ \ \ \ Merge remote-tracking branch 'php-src/master' into addGeneratorsSupportNikita Popov2012-08-201-26/+19
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merging master to fix Windows build Conflicts: Zend/zend_language_scanner.c Zend/zend_language_scanner_defs.h Zend/zend_vm_def.h
| * \ \ \ \ \ Merge remote-tracking branch 'php-src/master' into addGeneratorsSupportNikita Popov2012-08-131-19/+66
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is just an intial merge. It does not yet make generators and finally work together. Conflicts: Zend/zend_language_scanner.c Zend/zend_language_scanner_defs.h Zend/zend_vm_def.h Zend/zend_vm_execute.h Zend/zend_vm_execute.skl Zend/zend_vm_opcodes.h
| * | | | | | | Throw error also for return occuring before yieldNikita Popov2012-07-221-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | | | Remove reference restrictions from foreachNikita Popov2012-07-221-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | | | Require parenthesis around yield expressionsNikita Popov2012-07-221-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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().
| * | | | | | | Remove asterix modifier (*) for generatorsNikita Popov2012-07-201-27/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
| * | | | | | | Add support by yielding by-referenceNikita Popov2012-07-171-2/+10
| | | | | | | |
| * | | | | | | Add sceleton for yield* expressionNikita Popov2012-06-191-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This does not yet actually implement any delegation.
| * | | | | | | Add support for yielding keysNikita Popov2012-05-301-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | | | Allow to use yield without valueNikita Popov2012-05-291-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | | | Add support for $generator->send()Nikita Popov2012-05-291-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | | | Implement return for generatorsNikita Popov2012-05-261-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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;.
| * | | | | | | Add YIELD opcode implementationNikita Popov2012-05-261-1/+7
| | | | | | | |
| * | | | | | | Add ZEND_SUSPEND_AND_RETURN_GENERATOR opcodeNikita Popov2012-05-191-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the function is a generator this opcode will be invoked right after receiving the function arguments. The current implementation is just a dummy.
| * | | | | | | Add zend_do_suspend_if_generator callsNikita Popov2012-05-191-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The execution of generator functions will be suspended right after the arguments were RECVed. This will be done in zend_do_suspend_if_generator.
| * | | | | | | Add error if yield is used outside a generatorNikita Popov2012-05-191-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The yield statement can only be used in generator functions, which are marked with an asterix.
| * | | | | | | Minor code cleanupNikita Popov2012-05-191-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The block for the foreach separator was nested unnecessary. This commit simply removes that nesting.
| * | | | | | | Add flag for generator functionsNikita Popov2012-05-191-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | | | Add T_YIELD "yield" keywordNikita Popov2012-05-151-0/+6
| | | | | | | |
* | | | | | | | Bug #62956: fixing private method signature validationLars Strojny2012-08-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In inheritance, if both methods are private, don not enforce the same signature.
* | | | | | | | Fixed bug #62930, and more testsXinchen Hui2012-08-261-1/+4
| | | | | | | |
* | | | | | | | tabsXinchen Hui2012-08-261-6/+6
| | | | | | | |
* | | | | | | | Fixed bug #62931 & #62932Xinchen Hui2012-08-261-1/+6
| |_|_|_|/ / / |/| | | | | |
* | | | | | | Support list in foreachXinchen Hui2012-08-251-6/+11
| |_|_|/ / / |/| | | | | | | | | | | | | | | | | RFC: https://wiki.php.net/rfc/foreachlist
* | | | | | Merge branch 'PHP-5.4'Xinchen Hui2012-08-231-4/+4
|\ \ \ \ \ \ | | |_|_|/ / | |/| | | |
| * | | | | tabsXinchen Hui2012-08-231-14/+14
| | | | | |
* | | | | | Merge branch 'PHP-5.4'Xinchen Hui2012-08-231-2/+3
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Refix #62358, previous has side-affectXinchen Hui2012-08-231-2/+3
| | | | | |
* | | | | | Merge branch 'PHP-5.4'Xinchen Hui2012-08-231-1/+3
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Fixed bug #62358 (Segfault when using traits a lot)Xinchen Hui2012-08-231-1/+3
| | | | | |
* | | | | | Fixed bug that jmp in try block jmp over finally blockXinchen Hui2012-08-221-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | Refactor the implemention, make codes clear
* | | | | | stashXinchen Hui2012-08-221-0/+1
| |_|_|/ / |/| | | |
* | | | | Merge branch 'pull-request/31'Stanislav Malyshev2012-08-191-3/+0
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * pull-request/31: Fix lexing of nested heredoc strings in token_get_all()
| * | | | | Fix lexing of nested heredoc strings in token_get_all()Nikita Popov2012-03-311-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes bug #60097. Before two global variables CG(heredoc) and CG(heredoc_len) were used to track the current heredoc label. In order to support nested heredoc strings the *previous* heredoc label was assigned as the token value of T_START_HEREDOC and the language_parser.y assigned that to CG(heredoc). This created a dependency of the lexer on the parser. Thus the token_get_all() function, which accesses the lexer directly without also running the parser, was not able to tokenize nested heredoc strings (and leaked memory). Same applies for the source-code highlighting functions. The new approach is to maintain a heredoc_label_stack in the lexer, which contains all active heredoc labels. As it is no longer required, T_START_HEREDOC and T_END_HEREDOC now don't carry a token value anymore. In order to make the work with zend_ptr_stack in this context more convenient I added a new function zend_ptr_stack_top(), which retrieves the top element of the stack (similar to zend_stack_top()).
| * | | | | Fixed Bug #61052 (Missing error check in trait 'insteadof' clause)Stefan Marr2012-03-041-1/+16
| | | | | |
| * | | | | Fixed Bug #60911 (Confusing error message when extending traits)Stefan Marr2012-03-041-1/+1
| | | | | |
| * | | | | Fixed Bug #60717 (Order of traits in use statement can cause a fatal error)Stefan Marr2012-03-041-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # Compatibility is now correctly checked in both directions. # Introduced helper method for the test.
| * | | | | Fixed Bug #60809 (TRAITS - PHPDoc Comment Style Bug)Dmitry Stogov2012-01-201-64/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed some other traits related bugs (uninitialized variable, return => continue) Removed some trait related redundant code and variables