Permalink
Browse files

Added a check for Tree::Simple object in one of the new. Cannot put i…

…n header without a rakudo error. Stronger signature check for traverse. All test passing in exceptions however tests for visitor are fudged
  • Loading branch information...
Takadonet committed Nov 30, 2010
1 parent 7cac6d4 commit e4c9bcdc3c95f70683ebccd3b719b6651d6e0147
Showing with 297 additions and 246 deletions.
  1. +4 −1 lib/Tree/Simple.pm
  2. +293 −245 t/12_Tree_Simple_exceptions_test.t
View
@@ -66,7 +66,10 @@ multi method new($node,'root'){
return $x;
}
+#todo might be a rakudo bug where i cannot put the object type in the signatures without failing..
multi method new($node,$parent){
+ die 'Parent is not a Tree::Simple' if $parent !~~ Tree::Simple;
+
my $x = self.bless(*, node => $node,parent =>$parent,depth => $parent.getDepth() + 1);
#####
@@ -483,7 +486,7 @@ method fixWidth {
self.getParent().fixWidth() unless self.isRoot();
}
-method traverse($func,$post?) {
+method traverse(Code $func,Code $post?) {
# my ($self, $func, $post) = @_;
# (defined($func)) || die "Insufficient Arguments : Cannot traverse without traversal function";
# (ref($func) eq "CODE") || die "Incorrect Object Type : traversal function is not a function";
Oops, something went wrong.

0 comments on commit e4c9bcd

Please sign in to comment.