Skip to content

Commit 359bcab

Browse files
committed
Added static modifier
1 parent ae9ed12 commit 359bcab

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

src/macros.yay

+19-13
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ macro {
1010
·chain(
1111
async,
1212
·optional(
13-
·either(
14-
public,
15-
protected,
16-
private
13+
·repeat(
14+
·either(
15+
public,
16+
protected,
17+
private,
18+
static
19+
)·modifier
1720
)
18-
visibility,
21+
modifiers,
1922
function,
2023
·ns()·function,
2124
·token("("),
@@ -52,19 +55,22 @@ macro {
5255
·token(";")
5356
)
5457
} >> {··trim(
55-
·visibility function ·function(·args ···(, ) { ·arg ··· { ·argType ·argName ·argAssignmentEq ·argAssignmentVal } }): \Amp\Promise;
58+
··trim(·modifiers ···( ) { ·modifier }) function ·function(·args ···(, ) { ·arg ··· { ·argType ·argName ·argAssignmentEq ·argAssignmentVal } }): \Amp\Promise;
5659
)}
5760

5861
macro ·recursion {
5962
·chain(
6063
async,
6164
·optional(
62-
·either(
63-
public,
64-
protected,
65-
private
65+
·repeat(
66+
·either(
67+
public,
68+
protected,
69+
private,
70+
static
71+
)·modifier
6672
)
67-
visibility,
73+
modifiers,
6874
function,
6975
·ns()·function,
7076
·token("("),
@@ -161,7 +167,7 @@ macro ·recursion {
161167
}
162168
} >> {··trim(
163169
·scope ?·{
164-
·visibility function ·function(·args ···(, ) { ·arg ··· { ·argType ·argName ·argAssignmentEq ·argAssignmentVal } }): \Amp\Promise
170+
··trim(·modifiers ···( ) { ·modifier }) function ·function(·args ···(, ) { ·arg ··· { ·argType ·argName ·argAssignmentEq ·argAssignmentVal } }): \Amp\Promise
165171
{
166172
return call_user_func(PRE_ASYNC_WRAPPER, function () use (·scope ···(, ) { &·var }) {
167173
·body ·yields ?·{yield;}
@@ -170,7 +176,7 @@ macro ·recursion {
170176
}
171177

172178
·simple ?·{
173-
·visibility function ·function(·args ···(, ) { ·arg ··· { ·argType ·argName ·argAssignmentEq ·argAssignmentVal } }): \Amp\Promise
179+
··trim(·modifiers ···( ) { ·modifier }) function ·function(·args ···(, ) { ·arg ··· { ·argType ·argName ·argAssignmentEq ·argAssignmentVal } }): \Amp\Promise
174180
{
175181
return call_user_func(PRE_ASYNC_WRAPPER, function () {
176182
·body ·yields ?·{yield;}

tests/specs/async.spec

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ class AsyncClass
2020
{
2121
return "boo!";
2222
}
23+
24+
async public static function complex()
25+
{
26+
27+
}
2328
}
2429

2530
$first = async function() {
@@ -58,6 +63,13 @@ class AsyncClass
5863
yield;
5964
});
6065
}
66+
67+
public static function complex(): \Amp\Promise
68+
{
69+
return call_user_func(PRE_ASYNC_WRAPPER, function () {
70+
yield;
71+
});
72+
}
6173
}
6274

6375
$first = function (): \Amp\Promise {

0 commit comments

Comments
 (0)