Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle lists as right end point of Ranges
@A..@b should mean @.elems .. @b.elems.
We already had code to explicitly handle a list on the left hand side.
That it worked on the right hand side was probably due to some side
effect of the implementation that we lost when refactoring.
Add code to explicitly handle it once and for all instead.
  • Loading branch information
niner committed Aug 28, 2015
1 parent 64db548 commit 30cc6a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/Range.pm
Expand Up @@ -35,9 +35,11 @@ my class Range is Cool does Iterable does Positional {
$max == Inf || $min == -Inf,
);
}
multi method new($min is copy, $max, :$excludes-min, :$excludes-max) {
multi method new($min is copy, $max is copy, :$excludes-min, :$excludes-max) {
$min = +$min
if nqp::istype($min,List) || nqp::istype($min,Match);
$max = +$max
if nqp::istype($max,List) || nqp::istype($max,Match);
nqp::create(self).BUILD($min, $max, $excludes-min, $excludes-max);
}

Expand Down

0 comments on commit 30cc6a3

Please sign in to comment.