Permalink
Browse files

Add Bool method to Capture

Right now, defined captures evaluate to `True`, but empty captures should probably be `False`.
  • Loading branch information...
1 parent 11157e9 commit 9f873d89e3538e8cc8c9c41cbc9abd6f78e6499b @gerdr gerdr committed Mar 7, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/core/Capture.pm
View
@@ -69,6 +69,10 @@ my class Capture {
nqp::p6box_s(nqp::join(' ', $str))
}
+ multi method Bool(Capture:D:) {
+ $!list || $!hash ?? True !! False
+ }
+
method Capture(Capture:D:) {
self
}

0 comments on commit 9f873d8

Please sign in to comment.