Arquivos
hhvm/hphp/test/quick/inline_generator_body.php
T
jdelong b26e59a920 Inline the outer functions for continuations with no arguments
We store a bunch of data into an ActRec on the stack, then
call a php-level function that calls a C++ function to copy it into an
ActRec on the heap.  This should hopefully be a little better.
2013-05-01 20:59:45 -07:00

42 linhas
509 B
PHP

<?php
class CGetM {
private $x;
public function __construct() {
$this->x = "asdasd";
}
function getX() {
return $this->x;
}
public function genVarious() {
$local = $this->getX();
yield "a";
yield $local;
yield "c";
}
}
function foo() {
$k = new CGetM();
$z = $k->getX();
yield $z;
yield "\n";
}
function main() {
foreach (foo() as $x) {
echo $x;
}
$blah = new CGetM;
foreach ($blah->genVarious() as $x) {
echo $x;
}
}
main();
echo "\n";