Skip to content
Permalink
Browse files

Don't use nqp::ifnull on Dateish.daycount

It causes issues on the JVM backend, bartolin++ for repeatedly nudging me.
  • Loading branch information...
lizmat committed Mar 29, 2019
1 parent b5bf7cd commit e84f72706195bdddc87a0450bcf47667749b7e7b
Showing with 5 additions and 9 deletions.
  1. +1 −2 src/core/Date.pm6
  2. +0 −1 src/core/DateTime.pm6
  3. +4 −6 src/core/Dateish.pm6
@@ -31,8 +31,7 @@ my class Date does Dateish {
nqp::bind($!month, month);
nqp::bind($!day, day);
nqp::bind(&!formatter, formatter);
nqp::bind($!daycount,
nqp::isconcrete($daycount) ?? $daycount !! nqp::null);
nqp::bind($!daycount,$daycount) if nqp::isconcrete($!daycount);
self
}

@@ -66,7 +66,6 @@ my class DateTime does Dateish {
nqp::bind($!month, month);
nqp::bind($!day, day);
nqp::bind(&!formatter, &formatter);
nqp::bind($!daycount, nqp::null);
$!hour := hour;
$!minute := minute;
$!second := second;
@@ -31,11 +31,8 @@ my role Dateish {
sprintf 0 <= $!year <= 9999 ?? '%04d' !! '%+05d', $!year;
}

# make sure $!daycount is nulled for subclasses
method !SET-DAYCOUNT() {
nqp::bind($!daycount,nqp::null) unless nqp::isconcrete($!daycount);
self
}
# noop for subclasses
method !SET-DAYCOUNT() { self }

multi method new(Dateish:) {
Failure.new(
@@ -50,7 +47,8 @@ my role Dateish {
multi method gist(Dateish:D: --> Str:D) { self.Str }

method daycount(--> Int:D) {
nqp::ifnull(
nqp::if(
nqp::isconcrete($!daycount),
$!daycount,
$!daycount := self!calculate-daycount
)

0 comments on commit e84f727

Please sign in to comment.
You can’t perform that action at this time.