Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix sequences with Junction endpoints.
  • Loading branch information
jnthn committed Jan 10, 2013
1 parent 4eca84f commit 3c475e3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/operators.pm
Expand Up @@ -79,8 +79,8 @@ multi infix:<but>(Mu:U \obj, @roles) {
obj.HOW.mixin(obj, |@roles)
}

sub SEQUENCE($left, $right, :$exclude_end) {
my @right := $right.flat;
sub SEQUENCE($left, Mu $right, :$exclude_end) {
my @right := nqp::istype($right, Junction) ?? [$right] !! $right.flat;
my $endpoint = @right.shift;
my $infinite = $endpoint ~~ Whatever || $endpoint === $Inf;
$endpoint = Bool::False if $infinite;
Expand Down Expand Up @@ -178,10 +178,10 @@ sub WHAT(\x) {
}

proto sub infix:<...>(|) { * }
multi sub infix:<...>($a, $b) { SEQUENCE($a, $b) }
multi sub infix:<...>($a, Mu $b) { SEQUENCE($a, $b) }

proto sub infix:<...^>(|) { * }
multi sub infix:<...^>($a, $b) { SEQUENCE($a, $b, :exclude_end(1)) }
multi sub infix:<...^>($a, Mu $b) { SEQUENCE($a, $b, :exclude_end(1)) }

sub undefine(Mu \x) {
my $undefined;
Expand Down

0 comments on commit 3c475e3

Please sign in to comment.