repo.or.cz
/
hiphop-php.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
global statement removal: hphp/test [7/x]
[hiphop-php.git]
/
hphp
/
test
/
quick
/
closure_gen.php
blob
8cdfd7385693aa63aa56d609aa7998251de940f6
1
<
?hh
2
3
function
using_
(
$cgen
) {
4
foreach
(
$cgen
()
as
$x
) {
5
yield
$x
;
6
}
7
}
8
9
function
broke
() {
10
foreach
(
using_
(
function
() {
yield
1
;
yield
2
;
yield
3
; })
as
$x
) {
11
var_dump
(
$x
);
12
}
13
}
14
broke
();
15
16
class
c
{
17
function
genclo
() {
18
return function
() {
19
yield
$this
;
20
};
21
}
22
}
23
24
function
main
() {
25
$c
=
new
c
;
26
$f
=
$c
->
genclo
();
27
foreach
(
$f
()
as
$v
) {
28
var_dump
(
$v
);
29
}
30
}
31
main
();