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
Merge branch 'nom' into podparser
- Loading branch information
Showing
19 changed files
with
216 additions
and
51 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| role Perl6::Metamodel::PrivateMethodContainer { | ||
| has %!private_methods; | ||
|
|
||
| # Adds a private method. | ||
| method add_private_method($obj, $name, $code) { | ||
| if pir::exists(%!private_methods, $name) { | ||
| pir::die("Private method '$name' already declared in package " ~ | ||
| self.name($obj)); | ||
| } | ||
| %!private_methods{$name} := $code; | ||
| } | ||
|
|
||
| # Gets the table of private methods. | ||
| method private_method_table($obj) { | ||
| %!private_methods | ||
| } | ||
|
|
||
| # Locates a private method, and hands back null if it doesn't exist. | ||
| method find_private_method($obj, $name) { | ||
| pir::exists(%!private_methods, $name) ?? | ||
| %!private_methods{$name} !! | ||
| nqp::null() | ||
| } | ||
| } |
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,34 @@ | ||
| # Implements managing trust relationships between types. | ||
| role Perl6::Metamodel::Trusting { | ||
| # Who do we trust? | ||
| has @!trustees; | ||
|
|
||
| # Adds a type that we trust. | ||
| method add_trustee($obj, $trustee) { | ||
| @!trustees[+@!trustees] := $trustee; | ||
| } | ||
|
|
||
| # Introspect the types that we trust. | ||
| method trusts($obj) { | ||
| @!trustees | ||
| } | ||
|
|
||
| # Checks if we trust a certain type. Can be used by the compiler | ||
| # to check if a private call is allowable. | ||
| method is_trusted($obj, $claimant) { | ||
| # Always trust ourself. | ||
| if $claimant.WHAT =:= $obj.WHAT { | ||
| return 1; | ||
| } | ||
|
|
||
| # Otherwise, look through our trustee list. | ||
| for @!trustees { | ||
| if $_.WHAT =:= $claimant.WHAT { | ||
| return 1; | ||
| } | ||
| } | ||
|
|
||
| # If we get here, not trusted. | ||
| 0 | ||
| } | ||
| } |
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
Oops, something went wrong.