Permalink
Browse files

Use handled Failure for X::Sum::Push::Usage.

  It isn't perfect but at least it gets things up and running for star13
  Still some work to do to adapt to the new sink/failure handling
  • Loading branch information...
skids committed Jan 31, 2013
1 parent bf773fc commit c5edfb6eb1e8ad97d8f5e24a60044b601a5203b6
Showing with 7 additions and 3 deletions.
  1. +6 −2 lib/Sum.pm6
  2. +1 −1 t/sum.t
View
@@ -372,7 +372,9 @@ role Sum::Marshal::Raw {
# Pass the whole list to the class's add method, unprocessed.
sink self.add(@addends).grep({$_.WHAT ~~ Failure }).map:
{ return $_ };
- Failure.new(X::Sum::Push::Usage.new());
+ my $res = Failure.new(X::Sum::Push::Usage.new());
+ $res.defined;
+ $res;
};
# This allows simultaneous mixin of Sum::Partial
@@ -429,7 +431,9 @@ role Sum::Marshal::Cooked {
when Failure { return $_ };
}
};
- Failure.new(X::Sum::Push::Usage.new());
+ my $res = Failure.new(X::Sum::Push::Usage.new());
+ $res.defined;
+ $res;
}
}
View
@@ -175,7 +175,7 @@ class Foo5
method size () { 64 }
method finalize (*@addends) {
self.push(@addends);
- return fail(X::Sum::Missing.new()) unless self.whole;
+ return Failure.new(X::Sum::Missing.new()) unless self.whole;
$.accum;
}
method Numeric () { self.finalize };

0 comments on commit c5edfb6

Please sign in to comment.