Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove a few old workarounds for 4-year-old rakudo

  • Loading branch information...
commit cd2237a0c25b19bcf6b5f3e85d580006b803b98b 1 parent 140bca1
@timo timo authored committed
View
6 lib/Druid/Base.pm
@@ -15,10 +15,8 @@ grammar Druid::Move {
class Druid::Base {
# = Returns (zero-based) row and column, given a C<Match> object
method extract-coords(Match $m) {
- # RAKUDO: Hoping these explicit (...).Int conversions won't be
- # necessary in the long run.
- my Int $row = ($m<row_number> - 1).Int;
- my Int $column = (ord($m<col_letter>) - ord('a')).Int;
+ my Int $row = $m<row_number> - 1;
+ my Int $column = ord($m<col_letter>) - ord('a');
return ($row, $column);
}
View
4 lib/Druid/Game/Subject.pm
@@ -11,9 +11,7 @@ use Druid::Game::Observer;
#| are classes derived from C<Druid::View> or C<Druid::Player>.
role Druid::Game::Subject;
-# RAKUDO: Typed arrays don't really work yet
-#has Druid::Game::Observer @!observers;
-has @.observers;
+has Druid::Game::Observer @.observers;
#| Attaches a C<Druid::Game::Observer> to this object. From now on,
#| notifications going out to all listening objects will also go out to the
View
6 lib/Druid/View.pm
@@ -3,7 +3,7 @@ use v6;
use Druid::Game;
use Druid::Game::Observer;
-#=[Base class for classes that represent a C<Druid::Game> visually.]
+#= Base class for classes that represent a C<Druid::Game> visually.
class Druid::View is Druid::Base does Druid::Game::Observer;
has Druid::Game $.game handles <size layers colors heights>;
@@ -12,10 +12,8 @@ method add-piece() { ... }
method reset() { ... }
method swap() { ... }
-method new(Druid::Game :$game!) {
+submethod BUILD() {
$game.attach(self);
- # RAKUDO: This attribute should be auto-initialized
- $.game = $game;
}
# vim: filetype=perl6
View
7 lib/Druid/View/Text.pm
@@ -157,11 +157,10 @@ sub put($piece, $board, $height, $row, $column) {
#| octothorpes '#' insert actual spaces, i.e. act as a sort of
#| escape character for spaces.
sub merge($old, $new, $start) {
- my @old = $old.split('');
- my @new = $new.split('');
+ my @old = $old.comb;
+ my @new = $new.comb;
- # RAKUDO: xx and push don't seem to work as advertised.
- push @old, ' ' for ^($start + $new.chars - $old.chars);
+ push @old, ' ' xx $start + @new - @old;
for @new.kv -> $i, $char {
@old[$start + $i] = $char unless $char eq ' ';
View
5 lib/Test/Ix.pm
@@ -14,10 +14,7 @@ sub inject-subs-in-file($file) {
my @tests = find-all-tests-in-declaration($declaration);
for @tests -> $test {
my $subname = $test.subst(' ', '-', :global);
- # RAKUDO: Can't interpolate strings in regexes [perl #63892]
- #next if $code ~~ /'sub ' $subname/; # already in there
- my $subname-escaped = $subname.subst("'", "\\'", :global);
- next if $code ~~ eval("/'$subname-escaped'/"); # already in there
+ next if $code ~~ /'sub ' $subname/; # already in there
my $sub =
sprintf (join "\n", 'sub %s {', ' ok 0, "%s";', '}', ''),
$subname, $test;
View
10 t/01-game-rules.t
@@ -197,9 +197,8 @@ our sub passing-does-not-change-the-board {
my @heights-snapshot = $game.heights;
my @colors-snapshot = $game.colors;
$game.make-move('pass');
- # RAKUDO: eqv would be nicer here
- ok @heights-snapshot eq $game.heights
- || @colors-snapshot eq $game.colors,
+ ok @heights-snapshot eqv $game.heights
+ || @colors-snapshot eqv $game.colors,
"passing does not change the board";
}
@@ -224,9 +223,8 @@ our sub resigning-does-not-change-the-board {
my @heights-snapshot = $game.heights;
my @colors-snapshot = $game.colors;
$game.make-move('resign');
- # RAKUDO: eqv would be nicer here
- ok @heights-snapshot eq $game.heights
- || @colors-snapshot eq $game.colors,
+ ok @heights-snapshot eqv $game.heights
+ || @colors-snapshot eqv $game.colors,
"resigning does not change the board";
}
Please sign in to comment.
Something went wrong with that request. Please try again.