Skip to content

Commit

Permalink
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
jnthn committed Aug 7, 2012
1 parent e9bd21c commit 6849356
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/QAST/VarWithFallback.nqp
@@ -0,0 +1,4 @@
class QAST::VarWithFallback is QAST::Var {
has $!fallback;
method fallback(*@value) { $!fallback := @value[0] if @value; $!fallback }
}
1 change: 1 addition & 0 deletions tools/build/Makefile.in
Expand Up @@ -82,6 +82,7 @@ QAST_SOURCES = \
src/QAST/WVal.nqp \
src/QAST/Want.nqp \
src/QAST/Var.nqp \
src/QAST/VarWithFallback.nqp \
src/QAST/Op.nqp \
src/QAST/VM.nqp \
src/QAST/Stmts.nqp \
Expand Down

0 comments on commit 6849356

Please sign in to comment.