Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'nom' of https://github.com/rakudo/rakudo into nom
  • Loading branch information
Mouq committed Apr 20, 2014
2 parents e210385 + 22ca110 commit b55db03
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
19 changes: 13 additions & 6 deletions src/core/Supply.pm
Expand Up @@ -90,7 +90,7 @@ my role Supply {
method uniq(:&as,:&with) { SupplyOperations.uniq(self, :&as, :&with) }
method squish(:&as,:&with) { SupplyOperations.squish(self, :&as, :&with) }
method merge($s) { SupplyOperations.merge(self, $s) }
method zip($s, *@with) { SupplyOperations.zip(self, $s, |@with) }
method zip($s,:&with) { SupplyOperations.zip(self, $s, :&with) }
}

# The on meta-combinator provides a mechanism for implementing thread-safe
Expand Down Expand Up @@ -145,22 +145,29 @@ sub on(&setup) {
my @tappers = &!setup(self);
my $lock = Lock.new;

for @tappers -> $tap {
unless $tap ~~ Pair && $tap.key ~~ Supply {
sub add ($source, $what) {
unless $source ~~ Supply {
X::Supply::On::BadSetup.new.throw;
}
given $tap.value {
given $what {
when EnumMap {
self!add_source($tap.key, $lock, |$tap.value);
self!add_source($source, $lock, |$what);
}
when Callable {
self!add_source($tap.key, $lock, more => $tap.value);
self!add_source($source, $lock, more => $what);
}
default {
X::Supply::On::BadSetup.new.throw;
}
}
}

for @tappers -> $tap {
unless $tap ~~ Pair {
X::Supply::On::BadSetup.new.throw;
}
add( $_, $tap.value ) for $tap.key;
}
$sub
}

Expand Down
3 changes: 2 additions & 1 deletion src/core/SupplyOperations.pm
Expand Up @@ -259,7 +259,8 @@ my class SupplyOperations is repr('Uninstantiable') {
}
}

method zip(Supply $a, Supply $b, &with = &infix:<,>) {
method zip(Supply $a, Supply $b, :&with is copy ) {
&with //= &[,];
my @as;
my @bs;
on -> $res {
Expand Down
4 changes: 2 additions & 2 deletions t/spectest.data
Expand Up @@ -790,9 +790,9 @@ integration/advent2010-day04.t
integration/advent2012-day02.t
integration/advent2012-day03.t
integration/advent2012-day04.t #stress
integration/advent2012-day06.t
#integration/advent2012-day06.t # hangs since 17f4ee310239e1dd3d84c2205e479fdce8a7b966
integration/advent2012-day09.t
integration/advent2012-day10.t
#integration/advent2012-day10.t # hangs since 17f4ee310239e1dd3d84c2205e479fdce8a7b966
integration/advent2013-day02.t
integration/advent2013-day04.t
integration/advent2013-day06.t
Expand Down

0 comments on commit b55db03

Please sign in to comment.