363d1bb20f
This change is mostly for FB internal organizational reasons. Building is not effected beyond the fact that the target now lands in hphp/hhvm/hhvm rather than src/hhvm/hhvm.
32 linhas
418 B
PHP
32 linhas
418 B
PHP
<?php
|
|
|
|
function using($cgen) {
|
|
foreach ($cgen() as $x) {
|
|
yield $x;
|
|
}
|
|
}
|
|
|
|
function broke() {
|
|
foreach (using(function() { yield 1; yield 2; yield 3; }) as $x) {
|
|
var_dump($x);
|
|
}
|
|
}
|
|
broke();
|
|
|
|
class c {
|
|
function genclo() {
|
|
return function() use($this) {
|
|
yield $this;
|
|
};
|
|
}
|
|
}
|
|
|
|
function main() {
|
|
$c = new c;
|
|
$f = $c->genclo();
|
|
foreach ($f() as $v) {
|
|
var_dump($v);
|
|
}
|
|
}
|
|
main();
|