diff options
| author | Nikita Popov <nikic@php.net> | 2012-05-30 02:44:06 +0200 |
|---|---|---|
| committer | Nikita Popov <nikic@php.net> | 2012-05-30 02:44:06 +0200 |
| commit | bc08c2cf9485e20fea0eef7ab149cefdf9a3662e (patch) | |
| tree | 902abf875287ba8842600cc5e84557ee30bfc2f4 /Zend/zend_generators.h | |
| parent | 72a91d08e7d70d5524feb6cc7c8e32b3bd68f1df (diff) | |
| download | php-git-bc08c2cf9485e20fea0eef7ab149cefdf9a3662e.tar.gz | |
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.
Diffstat (limited to 'Zend/zend_generators.h')
| -rw-r--r-- | Zend/zend_generators.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index c9b43b31b6..2fd2c93b63 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -30,6 +30,8 @@ typedef struct _zend_generator { zend_execute_data *execute_data; /* Current value */ zval *value; + /* Current key */ + zval *key; /* Variable to put sent value into */ temp_variable *send_target; } zend_generator; |
