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
Add QAST::VarWithFallback, a way to give a handful of variables a fal…
…lback way to do a lookup should the initial lookup return null. For use of things like contextuals, or when the fallback is to throw an error.
- Loading branch information
Showing
2 changed files
with
5 additions
and
0 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| class QAST::VarWithFallback is QAST::Var { | ||
| has $!fallback; | ||
| method fallback(*@value) { $!fallback := @value[0] if @value; $!fallback } | ||
| } |
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