-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix instrumentation to allow use of yield statements as expressions >_<
- Loading branch information
Showing
14 changed files
with
97 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/fixture/Instrumentation/Instrumentor/yield-expression.input.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
/** | ||
* This case verifies yield is instrumented correctly when used as an expression. | ||
*/ | ||
|
||
use Generator as Coroutine; | ||
|
||
function () : Coroutine { | ||
$v = yield 1; | ||
return yield 2; | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/fixture/Instrumentation/Instrumentor/yield-expression.output.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
/** | ||
* This case verifies yield is instrumented correctly when used as an expression. | ||
*/ | ||
|
||
use Generator as Coroutine; | ||
|
||
function () : Coroutine { | ||
assert((($μ = \class_exists(\Recoil\Dev\Instrumentation\Trace::class) ? yield \Recoil\Dev\Instrumentation\Trace::install() : null) && $μ->setCoroutine(__FILE__, __CLASS__, __FUNCTION__, '->', \func_get_args())) || true); $v = (!assert(($μ && $μ->setLine(__LINE__)) || true) ?: yield 1); | ||
return (!assert(($μ && $μ->setLine(__LINE__)) || true) ?: yield 2); | ||
}; |
10 changes: 10 additions & 0 deletions
10
test/fixture/Instrumentation/Instrumentor/yield-key.input.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
/** | ||
* This case verifies that yields are instrumented correctly when they have a key. | ||
*/ | ||
|
||
use Generator as Coroutine; | ||
|
||
function () : Coroutine { | ||
yield 1 => 2; | ||
}; |
10 changes: 10 additions & 0 deletions
10
test/fixture/Instrumentation/Instrumentor/yield-key.output.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
/** | ||
* This case verifies that yields are instrumented correctly when they have a key. | ||
*/ | ||
|
||
use Generator as Coroutine; | ||
|
||
function () : Coroutine { | ||
assert((($μ = \class_exists(\Recoil\Dev\Instrumentation\Trace::class) ? yield \Recoil\Dev\Instrumentation\Trace::install() : null) && $μ->setCoroutine(__FILE__, __CLASS__, __FUNCTION__, '->', \func_get_args())) || true); (!assert(($μ && $μ->setLine(__LINE__)) || true) ?: yield 1 => 2); | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/fixture/Instrumentation/Instrumentor/yield-no-value.input.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
/** | ||
* This case verifies that yields are instrumented correctly when they do not | ||
* have a value. | ||
*/ | ||
|
||
use Generator as Coroutine; | ||
|
||
function () : Coroutine { | ||
yield; | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/fixture/Instrumentation/Instrumentor/yield-no-value.output.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
/** | ||
* This case verifies that yields are instrumented correctly when they do not | ||
* have a value. | ||
*/ | ||
|
||
use Generator as Coroutine; | ||
|
||
function () : Coroutine { | ||
assert((($μ = \class_exists(\Recoil\Dev\Instrumentation\Trace::class) ? yield \Recoil\Dev\Instrumentation\Trace::install() : null) && $μ->setCoroutine(__FILE__, __CLASS__, __FUNCTION__, '->', \func_get_args())) || true); (!assert(($μ && $μ->setLine(__LINE__)) || true) ?: yield); | ||
}; |