File tree Expand file tree Collapse file tree 2 files changed +27
-31
lines changed Expand file tree Collapse file tree 2 files changed +27
-31
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
3
macro ·recursion {
4
- async function(···parameters) {···body}
4
+ async function (···parameters) {···body}
5
5
} >> {
6
- call_user_func(function($outer) {
7
- return function(···parameters) use ($outer) {
8
- $generator = call_user_func(function($inner) use ($outer) {
9
- return function( ) use ($outer, $inner ) {
10
- extract( $outer);
11
- extract($inner );
12
- ···body
13
- };
14
- }, get_defined_vars()) ;
15
-
16
- return new \Amp\Coroutine($generator() );
6
+ call_user_func(function ($outer) {
7
+ return function (···parameters) use ($outer) {
8
+ return Amp\call(
9
+ call_user_func( function ($inner ) use ($outer) {
10
+ return function () use ( $outer, $inner) {
11
+ extract($outer );
12
+ extract($inner);
13
+ ···body
14
+ } ;
15
+ }, get_defined_vars())
16
+ );
17
17
};
18
18
}, get_defined_vars())
19
19
}
@@ -22,14 +22,12 @@ macro ·recursion {
22
22
async function ·ns()·function (···parameters) {···body}
23
23
} >> {
24
24
function ·function(···parameters) {
25
- return call_user_func(function($context) {
26
- $generator = function() use ($context) {
25
+ return call_user_func(function ($context) {
26
+ return Amp\call( function () use ($context) {
27
27
extract($context);
28
28
29
29
···body
30
- };
31
-
32
- return new \Amp\Coroutine($generator());
30
+ });
33
31
}, get_defined_vars());
34
32
}
35
33
}
Original file line number Diff line number Diff line change @@ -19,28 +19,26 @@ $async = async function($path) {
19
19
function read ($path )
20
20
{
21
21
return call_user_func (function ($context·0 ) {
22
- $ generator·0 = function () use ($context·0 ) {
22
+ return Amp \ call ( function () use ($context·0 ) {
23
23
extract ($context·0 );
24
24
25
25
$content = yield \Amp \File \get ($path );
26
26
return $content ;
27
- };
28
-
29
- return new \Amp \Coroutine ($generator·0 ());
27
+ });
30
28
}, get_defined_vars ());
31
29
}
32
30
33
31
$async = call_user_func (function ($outer·1 ) {
34
32
return function ($path ) use ($outer·1 ) {
35
- $ generator·1 = call_user_func ( function ($ inner·1 ) use ($ outer·1 ) {
36
- return function () use ($outer·1 , $ inner ·1 ) {
37
- extract ( $outer·1 );
38
- extract ($inner ·1 );
39
- $ content = yield \ Amp \ File \ get ($ path );
40
- return $content ;
41
- } ;
42
- }, get_defined_vars ()) ;
43
-
44
- return new \ Amp \ Coroutine ($ generator·1 () );
33
+ return Amp \ call (
34
+ call_user_func ( function ($ inner·1 ) use ($outer·1 ) {
35
+ return function () use ( $outer·1 , $ inner·1 ) {
36
+ extract ($outer ·1 );
37
+ extract ($ inner·1 );
38
+ $content = yield \ Amp \ File \ get ($ path ) ;
39
+ return $ content ;
40
+ } ;
41
+ }, get_defined_vars ())
42
+ );
45
43
};
46
44
}, get_defined_vars ());
You can’t perform that action at this time.
0 commit comments