Skip to content

Commit

Permalink
Added static modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
assertchris committed Jun 30, 2017
1 parent ae9ed12 commit 359bcab
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
32 changes: 19 additions & 13 deletions src/macros.yay
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ macro {
·chain(
async,
·optional(
·either(
public,
protected,
private
·repeat(
·either(
public,
protected,
private,
static
)·modifier
)
visibility,
modifiers,
function,
·ns()·function,
·token("("),
Expand Down Expand Up @@ -52,19 +55,22 @@ macro {
·token(";")
)
} >> {··trim(
·visibility function ·function(·args ···(, ) { ·arg ··· { ·argType ·argName ·argAssignmentEq ·argAssignmentVal } }): \Amp\Promise;
··trim(·modifiers ···( ) { ·modifier }) function ·function(·args ···(, ) { ·arg ··· { ·argType ·argName ·argAssignmentEq ·argAssignmentVal } }): \Amp\Promise;
)}

macro ·recursion {
·chain(
async,
·optional(
·either(
public,
protected,
private
·repeat(
·either(
public,
protected,
private,
static
)·modifier
)
visibility,
modifiers,
function,
·ns()·function,
·token("("),
Expand Down Expand Up @@ -161,7 +167,7 @@ macro ·recursion {
}
} >> {··trim(
·scope ?·{
·visibility function ·function(·args ···(, ) { ·arg ··· { ·argType ·argName ·argAssignmentEq ·argAssignmentVal } }): \Amp\Promise
··trim(·modifiers ···( ) { ·modifier }) function ·function(·args ···(, ) { ·arg ··· { ·argType ·argName ·argAssignmentEq ·argAssignmentVal } }): \Amp\Promise
{
return call_user_func(PRE_ASYNC_WRAPPER, function () use (·scope ···(, ) { &·var }) {
·body ·yields ?·{yield;}
Expand All @@ -170,7 +176,7 @@ macro ·recursion {
}

·simple ?·{
·visibility function ·function(·args ···(, ) { ·arg ··· { ·argType ·argName ·argAssignmentEq ·argAssignmentVal } }): \Amp\Promise
··trim(·modifiers ···( ) { ·modifier }) function ·function(·args ···(, ) { ·arg ··· { ·argType ·argName ·argAssignmentEq ·argAssignmentVal } }): \Amp\Promise
{
return call_user_func(PRE_ASYNC_WRAPPER, function () {
·body ·yields ?·{yield;}
Expand Down
12 changes: 12 additions & 0 deletions tests/specs/async.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ class AsyncClass
{
return "boo!";
}

async public static function complex()
{

}
}

$first = async function() {
Expand Down Expand Up @@ -58,6 +63,13 @@ class AsyncClass
yield;
});
}

public static function complex(): \Amp\Promise
{
return call_user_func(PRE_ASYNC_WRAPPER, function () {
yield;
});
}
}

$first = function (): \Amp\Promise {
Expand Down

0 comments on commit 359bcab

Please sign in to comment.