Skip to content

Commit

Permalink
- Array.rotate() will always return a new array.
Browse files Browse the repository at this point in the history
- Fixed the positions of two errors inside the Parser.
  • Loading branch information
trizen committed Nov 25, 2015
1 parent 7de49f0 commit 606c837
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/Sidef/Parser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ package Sidef::Parser {
return Sidef::Variable::NamedParam->new($name, $obj);
}

# Declaration of variable types
# Declaration of variables
if (/\Gvar\b\h*/gc) {
my $type = 'var';
my $vars = $self->parse_init_vars(code => $opt{code}, type => $type);
Expand Down Expand Up @@ -1021,7 +1021,7 @@ package Sidef::Parser {
$args = $self->parse_obj(code => $opt{code});
$args // $self->fatal_error(
code => $_,
pos => pos,
pos => pos($_) - 2,
error => qq{expected an expression after "=" in `has` declaration},
);
}
Expand Down Expand Up @@ -1056,7 +1056,7 @@ package Sidef::Parser {
my $obj = $self->parse_obj(code => $opt{code});
$obj // $self->fatal_error(
code => $_,
pos => pos,
pos => pos($_) - 2,
error => qq{expected an expression after $type "$name"},
);

Expand Down
2 changes: 1 addition & 1 deletion lib/Sidef/Types/Array/Array.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ package Sidef::Types::Array::Array {
my ($self, $num) = @_;
$num = $num->get_value % ($#{$self} + 1);
return $self if $num == 0;
return $self->new(@{$self}) if $num == 0;
# Surprisingly, this is slower:
# $self->new(@{$self}[$num .. $#{$self}], @{$self}[0 .. $num - 1]);
Expand Down

0 comments on commit 606c837

Please sign in to comment.