Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Implement .^can returning something that as well as being useful in b…
…oolean context can also be invoked to run the first method that would be handed back or used as an iterator to get all methods that we could call. Also re-work a few things in P6Invocation to look more like it probably should have in the first place - I'd seen this coming anyway. One bug .^can on proto-objects + iteration does not yet work.
- Loading branch information
Showing
6 changed files
with
130 additions
and
31 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| ## $Id$ | ||
|
|
||
| =head1 NAME | ||
|
|
||
| src/parrot/P6Invocation - extra methods for the P6Invocation PMC | ||
|
|
||
| =head2 Methods on P6Invocation | ||
|
|
||
| We also add some methods to P6Invocation. | ||
|
|
||
| =item !flatten | ||
|
|
||
| Here so that list(...) will behave nicely. No doubt can change substantially | ||
| when we have laziness support. | ||
|
|
||
| =cut | ||
|
|
||
| .namespace ["P6Invocation"] | ||
| .sub '!flatten' :method | ||
| .local pmc result | ||
| result = new ['ResizablePMCArray'] | ||
| it_loop: | ||
| unless self goto it_loop_end | ||
| $P0 = shift self | ||
| push result, $P0 | ||
| goto it_loop | ||
| it_loop_end: | ||
| .return (result) | ||
| .end | ||
|
|
||
| =back | ||
|
|
||
| =cut | ||
|
|
||
| # Local Variables: | ||
| # mode: pir | ||
| # fill-column: 100 | ||
| # End: | ||
| # vim: expandtab shiftwidth=4 ft=pir: |
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