Permalink
Browse files

do tree walking of packages instead of grepping

Following up on
31b5319#commitcomment-17801202

I got an EVAL in there which I haven't figured out how to get rid
of yet.

Closes #141.
  • Loading branch information...
1 parent c1d413d commit fe2ebe5a632446012ecff660de59af19132e9b1f @masak committed Jun 14, 2016
Showing with 17 additions and 3 deletions.
  1. +17 −3 t/integration/val-q-classes.t
@@ -1,9 +1,23 @@
use v6;
+use MONKEY-SEE-NO-EVAL;
use Test;
+use _007;
-my @p6types = flat
- "lib/_007/Q.pm".IO.lines.map({ ~$0 if /^ < class role > \h+ ("Q::" \S+)/ }),
- "lib/_007/Val.pm".IO.lines.map({ ~$0 if /^ class \h+ ("Val::" \S+)/ });
+sub tree-walk($package, @accum) {
+ for $package.keys -> $key {
+ my $name = "{$package}::{$key}";
+ # make a little exception for Val::Sub::Builtin, which is just an
+ # implementation detail and doesn't have a corresponding builtin
+ # (because it tries to pass itself off as a Val::Sub)
+ next if $name eq "Val::Sub::Builtin";
+ push @accum, $name;
+ tree-walk(EVAL("{$name}::"), @accum)
+ }
+}
+
+my @p6types;
+tree-walk(Q::, @p6types);
+tree-walk(Val::, @p6types);
my @builtins = "lib/_007/Runtime/Builtins.pm".IO.lines.map({
~$0 if /^ \h+ ([Val|Q] "::" <-[,]>+) "," \h* $/

0 comments on commit fe2ebe5

Please sign in to comment.