Skip to content

Commit

Permalink
move Date ops to core2
Browse files Browse the repository at this point in the history
fails during compilation of CORE with "rtype not set"
  • Loading branch information
moritz committed Jan 8, 2012
1 parent b8af1ec commit 390b435
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 37 deletions.
37 changes: 0 additions & 37 deletions src/core/Temporal.pm
Original file line number Diff line number Diff line change
Expand Up @@ -468,43 +468,6 @@ my class Date does Dateish {
"Date.new($.year.perl(), $.month.perl(), $.day.perl())";
}
}

multi infix:<+>(Date:D $d, Int:D $x) {
Date.new-from-daycount($d.daycount + $x)
}
multi infix:<+>(Int:D $x, Date:D $d) {
Date.new-from-daycount($d.daycount + $x)
}
multi infix:<->(Date:D $d, Int:D $x) {
Date.new-from-daycount($d.daycount - $x)
}
multi infix:<->(Date:D $a, Date:D $b) {
$a.daycount - $b.daycount;
}
multi infix:<cmp>(Date:D $a, Date:D $b) {
$a.daycount cmp $b.daycount
}
multi infix:«<=>»(Date:D $a, Date:D $b) {
$a.daycount <=> $b.daycount
}
multi infix:<==>(Date:D $a, Date:D $b) {
$a.daycount == $b.daycount
}
multi infix:<!=>(Date:D $a, Date:D $b) {
$a.daycount != $b.daycount
}
multi infix<=»(Date:D $a, Date:D $b) {
$a.daycount <= $b.daycount
}
multi infix<»(Date:D $a, Date:D $b) {
$a.daycount < $b.daycount
}
multi infix>=»(Date:D $a, Date:D $b) {
$a.daycount >= $b.daycount
}
multi infix>»(Date:D $a, Date:D $b) {
$a.daycount > $b.daycount
}

$PROCESS::TZ = DateTime-local-timezone.new;

Expand Down
37 changes: 37 additions & 0 deletions src/core2/Temporal-ops.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
multi infix:<+>(Date:D $d, Int:D $x) {
Date.new-from-daycount($d.daycount + $x)
}
multi infix:<+>(Int:D $x, Date:D $d) {
Date.new-from-daycount($d.daycount + $x)
}
multi infix:<->(Date:D $d, Int:D $x) {
Date.new-from-daycount($d.daycount - $x)
}
multi infix:<->(Date:D $a, Date:D $b) {
$a.daycount - $b.daycount;
}
multi infix:<cmp>(Date:D $a, Date:D $b) {
$a.daycount cmp $b.daycount
}
multi infix:«<=>»(Date:D $a, Date:D $b) {
$a.daycount <=> $b.daycount
}
multi infix:<==>(Date:D $a, Date:D $b) {
$a.daycount == $b.daycount
}
multi infix:<!=>(Date:D $a, Date:D $b) {
$a.daycount != $b.daycount
}
multi infix<=»(Date:D $a, Date:D $b) {
$a.daycount <= $b.daycount
}
multi infix<»(Date:D $a, Date:D $b) {
$a.daycount < $b.daycount
}
multi infix>=»(Date:D $a, Date:D $b) {
$a.daycount >= $b.daycount
}
multi infix>»(Date:D $a, Date:D $b) {
$a.daycount > $b.daycount
}

1 change: 1 addition & 0 deletions tools/build/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ CORE_SOURCES = \

CORE2_SOURCES = \
src/core/Grammar.pm \
src/core2/Temporal-ops.pm \
src/core2/Main.pm \
src/core2/Pod.pm \
src/core2/fixups.pm \
Expand Down

0 comments on commit 390b435

Please sign in to comment.