History log of /PHP-7.4/Zend/zend_generators.h (Results 51 – 65 of 65)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: php-5.3.17, php-5.4.7, php-5.4.7RC1
# f53225a9 25-Aug-2012 Nikita Popov

Fix several issues and allow rewind only at/before first yield

* Trying to resume a generator while it is already running now throws a
fatal error.
* Trying to use yield in fina

Fix several issues and allow rewind only at/before first yield

* Trying to resume a generator while it is already running now throws a
fatal error.
* Trying to use yield in finally while the generator is being force-closed
(by GC) throws a fatal error.
* Rewinding after the first yield now throws an Exception

show more ...


# 4d8edda3 24-Aug-2012 Nikita Popov

Run finally if generator is closed before finishing


# 9003cd14 20-Aug-2012 Nikita Popov

Fix zts build (typo)


# 05f10480 20-Aug-2012 Nikita Popov

Drop Generator::close() method


Revision tags: php-5.3.16, php-5.4.6, php-5.4.6RC1
# 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, php-5.3.15, php-5.3.15RC1, php-5.4.5RC1
# ab75ed6b 23-Jun-2012 Nikita Popov

Disallow closing a generator during its execution

If a generator is closed while it is running an E_WARNING is thrown and the
call is ignored. Maybe a fatal error should be thrown instea

Disallow closing a generator during its execution

If a generator is closed while it is running an E_WARNING is thrown and the
call is ignored. Maybe a fatal error should be thrown instead?

show more ...


Revision tags: php-5.3.14, php-5.4.4
# ee89e228 30-May-2012 Nikita Popov

Allow yielding during function calls

During function calls arguments are pushed onto the stack. Now these are
backed up on yield and restored on resume. This requires memcpy'ing them,

Allow yielding during function calls

During function calls arguments are pushed onto the stack. Now these are
backed up on yield and restored on resume. This requires memcpy'ing them,
but there doesn't seem to be any better way to do it.

Also this fixes the issue with exceptions thrown during function calls.

show more ...


Revision tags: php-5.3.14RC2, php-5.4.4RC2
# 87901602 30-May-2012 Nikita Popov

Add auto-increment keys

When no key is explicitely yielded PHP will used auto-incrementing keys
as a fallback. They behave the same as with arrays, i.e. the key is the
successor of t

Add auto-increment keys

When no key is explicitely yielded PHP will used auto-incrementing keys
as a fallback. They behave the same as with arrays, i.e. the key is the
successor of the largest previously used integer key.

show more ...


# 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 ...


# 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 ...


# 64a643a4 27-May-2012 Nikita Popov

Free loop variables

If the generator is closed before it has finished running, it may happen
that some FREE or SWITCH_FREE opcodes haven't been executed and memory is
leaked.

Free loop variables

If the generator is closed before it has finished running, it may happen
that some FREE or SWITCH_FREE opcodes haven't been executed and memory is
leaked.

This fixes it by walking the brk_cont_array and manually freeing the
variables.

show more ...


# d49d3971 26-May-2012 Nikita Popov

Close generator on return


# f627be52 26-May-2012 Nikita Popov

Add support for executing a zend_execute_data

This adds another function execute_ex(), which accepts a zend_execute_data
struct to run (contrary to execute(), which accepts a zend_op_arr

Add support for executing a zend_execute_data

This adds another function execute_ex(), which accepts a zend_execute_data
struct to run (contrary to execute(), which accepts a zend_op_array from
which it initialized the execute_data).

This needs a bit more cleanup.

show more ...


# 9ce9a7e6 23-May-2012 Nikita Popov

Add initial code for suspending execution

This is just some initial code, which is still quite broken (and needs to be
moved so it can be reused.)


# ca59e546 19-May-2012 Nikita Popov

Add empty Generator class


123