Skip to content

Commit

Permalink
Fix andthen, notandthen, and orelse for 1-arg Iterable case
Browse files Browse the repository at this point in the history
Be sure we update the $els var after we swap the 1-arg iterable
to be our list of args.
  • Loading branch information
zoffixznet committed Apr 29, 2017
1 parent fdb2b2a commit 1ed76a9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/core/operators.pm
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,8 @@ sub infix:<andthen>(+a) {
nqp::iseq_i($els, 1) && nqp::istype($current, Iterable),
nqp::stmts(
($args := $current.List),
$current := $args[0])),
($current := $args[0]),
$els = $args.elems)),
(my int $i),
nqp::until(
nqp::iseq_i($els, $i = nqp::add_i($i, 1))
Expand Down Expand Up @@ -701,7 +702,8 @@ sub infix:<notandthen>(+a) {
nqp::iseq_i($els, 1) && nqp::istype($current, Iterable),
nqp::stmts(
($args := $current.List),
$current := $args[0])),
($current := $args[0]),
$els = $args.elems)),
(my int $i),
nqp::until(
nqp::iseq_i($els, $i = nqp::add_i($i, 1))
Expand Down Expand Up @@ -731,7 +733,8 @@ sub infix:<orelse>(+$) {
nqp::iseq_i($els, 1) && nqp::istype($current, Iterable),
nqp::stmts(
($args := $current.List),
$current := $args[0])),
($current := $args[0]),
$els = $args.elems)),
(my int $i),
nqp::until(
$current.defined || nqp::iseq_i($els, $i = nqp::add_i($i, 1)),
Expand Down

0 comments on commit 1ed76a9

Please sign in to comment.