Skip to content

Commit

Permalink
Don't use nqp::ifnull on Dateish.daycount
Browse files Browse the repository at this point in the history
It causes issues on the JVM backend, bartolin++ for repeatedly nudging me.
  • Loading branch information
lizmat committed Mar 29, 2019
1 parent b5bf7cd commit e84f727
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/core/Date.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
1 change: 0 additions & 1 deletion src/core/DateTime.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 4 additions & 6 deletions src/core/Dateish.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
)
Expand Down

0 comments on commit e84f727

Please sign in to comment.