Arquivos
hhvm/hphp/test/quick/debugger/flow_gen_async.php.disabled
T
Mirek Klimos 705d2ac5cd Eager execution of async function.
Currently, a call to an async function returns a (Continuation)WaitHandle
object but the excution of the function body doesn't start before await
(or join()) on the WaitHandle is called. This changes it to start the
execution immediately and the control is returned to the caller only
after it's blocked.

Differential Revision: D946914
2013-09-06 17:52:38 -07:00

32 linhas
504 B
Plaintext

<?hh
// Test the following using async
// - Stepping over awaits.
// - Stepping over the return from an async
async function genBar($a) {
var_dump($a);
error_log('Finished in genBar');
return $a + 2;
}
async function genFoo($a) {
var_dump($a);
$a++;
$a = await genBar($a);
var_dump($a);
error_log('Finished in genFoo');
return $a;
}
function foo($a) {
$result = genFoo($a)->join();
var_dump($result);
}
function test($a) {
foo($a);
}
error_log('flow_gen_async.php loaded');