diff options
| author | Nikita Popov <nikic@php.net> | 2012-05-19 23:11:18 +0200 |
|---|---|---|
| committer | Nikita Popov <nikic@php.net> | 2012-05-19 23:19:21 +0200 |
| commit | 1cec3f12cc719ccde286a3a55f6da1a5bf9ea2e4 (patch) | |
| tree | 91528939e3c443644d5d86481d62efe93691d8cc /Zend/zend_compile.c | |
| parent | e14cfafcbfbe58e0fc3f7b814698a908b0dffca5 (diff) | |
| download | php-git-1cec3f12cc719ccde286a3a55f6da1a5bf9ea2e4.tar.gz | |
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.
Diffstat (limited to 'Zend/zend_compile.c')
| -rw-r--r-- | Zend/zend_compile.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 831f9f9d3f..f0802efd58 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2670,12 +2670,18 @@ void zend_do_yield(znode *expr TSRMLS_DC) /* {{{ */ void zend_do_suspend_if_generator(TSRMLS_D) /* {{{ */ { + zend_op *opline; + // we only suspend execution if the current function is a generator if ((CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) == 0) { return; } - /* do nothing for now */ + opline = get_next_op(CG(active_op_array) TSRMLS_CC); + + opline->opcode = ZEND_SUSPEND_AND_RETURN_GENERATOR; + SET_UNUSED(opline->op1); + SET_UNUSED(opline->op2); } /* }}} */ |
