97a23e5ea7
Updates continuations to allow yielding of a key-value pair from a generator. Adds bytecode instructions (PackContK, ContKey) for using the new feature, and adds IR instructions (ContUpdateIdx, ContIncKey) to help get it down to the metal (in particular, ContIncKey attempts to keep the current use-cases as fast as possible).
15 linhas
205 B
PHP
15 linhas
205 B
PHP
<?php
|
|
|
|
function foo() {
|
|
yield 1 => 2;
|
|
yield "a" => "b";
|
|
}
|
|
|
|
$gen = foo();
|
|
$gen->next();
|
|
var_dump($gen->key());
|
|
var_dump($gen->current());
|
|
$gen->next();
|
|
var_dump($gen->key());
|
|
var_dump($gen->current());
|