Skip to content

Commit

Permalink
Fix some issues with R:I.OneValue
Browse files Browse the repository at this point in the history
- make sure sink-all works ok on JVM
- add support for skip-one
  • Loading branch information
lizmat committed Aug 13, 2017
1 parent 30584da commit 3ad3346
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/core/Rakudo/Iterator.pm
Expand Up @@ -2186,7 +2186,26 @@ class Rakudo::Iterator {
#?endif
)
}
method sink-all(--> IterationEnd) { $!value := nqp::null }
method skip-one() {
nqp::if(
#?if jvm
nqp::not_i(nqp::eqaddr($!value,Mu)),
nqp::isfalse($!value := Mu))
#?endif
#?if !jvm
nqp::not_i(nqp::isnull($!value)),
nqp::isfalse($!value := nqp::null)
#?endif
)
}
method sink-all(--> IterationEnd) {
#?if jvm
$!value := Mu
#?endif
#?if !jvm
$!value := nqp::null
#?endif
}
method count-only(--> 1) { }
method bool-only(--> True) { }
}.new(value)
Expand Down

4 comments on commit 3ad3346

@b2gills
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would make more sense to store IterationEnd to $!value than Mu on the JVM.
That way it could return Mu

@lizmat
Copy link
Contributor Author

@lizmat lizmat commented on 3ad3346 Aug 14, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mid1221213
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo at line 2193, an unfortunate supplementary closing parenthesis that prevents building of the JVM Rakudo backend.

@zoffixznet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo at line 2193, an unfortunate supplementary closing parenthesis that prevents building of the JVM Rakudo backend.

Fixed in 63cdc42 Thanks

Please sign in to comment.