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