Skip to content

Commit

Permalink
Revert "Revert "Replace postfix ++/-- with prefix where possible""
Browse files Browse the repository at this point in the history
This reverts commit 370073f.

See issue #1315.
  • Loading branch information
AlexDaniel committed Dec 16, 2017
1 parent 8159e38 commit ae6177c
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/core/Awaiter.pm
Expand Up @@ -60,7 +60,7 @@ my class Awaiter::Blocking does Awaiter {
nqp::push_i(indices, $insert);
}

$insert++;
++$insert;
}

# See if we have anything that we need to really block on. If so, we
Expand All @@ -72,7 +72,7 @@ my class Awaiter::Blocking does Awaiter {
my $l = Lock.new;
my $ready = $l.condition();
my int $remaining = $num-handles;
loop (my int $i = 0; $i < $num-handles; $i++) {
loop (my int $i = 0; $i < $num-handles; ++$i) {
my $handle := nqp::atpos(handles, $i);
my int $insert = nqp::atpos_i(indices, $i);
$handle.subscribe-awaiter(-> \success, \result {
Expand Down
4 changes: 2 additions & 2 deletions src/core/Baggy.pm
Expand Up @@ -611,7 +611,7 @@ my role Baggy does QuantHash {
).throw;
}
else {
self{$tested}++;
++self{$tested};
}
}
self;
Expand Down Expand Up @@ -647,7 +647,7 @@ my role Baggy does QuantHash {
# simple categorize
else {
loop {
self{$_}++ for @$tested;
++self{$_} for @$tested;
last if ($value := iter.pull-one) =:= IterationEnd;
nqp::istype(($tested := test($value))[0], Iterable)
and X::Invalid::ComputedValue.new(
Expand Down
6 changes: 3 additions & 3 deletions src/core/Block.pm
Expand Up @@ -206,7 +206,7 @@ my class Block { # declared in BOOTSTRAP
# Normal Positionals
my Int $idx = -1;
for $sig.params.grep(*.positional) -> $parm {
$idx++;
++$idx;
unless $idx < primers.list.elems {
@plist.push($parm);
@clist.push($capwrap ~ '[' ~ @plist.end ~ ']');
Expand All @@ -230,7 +230,7 @@ my class Block { # declared in BOOTSTRAP
@tlist.push($slurp_p) if $slurp_p;
@plist.push($slurp_p) if $slurp_p and not $slurp_p.capture;

$idx++;
++$idx;
my $cidx = 0;

# Even if we prime above the arity, do it anyway, for errors.
Expand All @@ -254,7 +254,7 @@ my class Block { # declared in BOOTSTRAP
@clist.push("primers.list[$idx]");
}
}
$idx++;
++$idx;
}
if $slurp_p {
@clist.push('|' ~ $capwrap ~ '[' ~ ++$widx ~ '..*-1]' );
Expand Down
2 changes: 1 addition & 1 deletion src/core/Deprecations.pm
Expand Up @@ -101,7 +101,7 @@ sub DEPRECATED($alternative,$from?,$removed?,:$up = 1,:$what,:$file,:$line,Bool
die $dep.report if $fatal;

# update callsite
$dep.callsites{$file // $callsite.file.IO}{$line // $callsite.line}++;
++$dep.callsites{$file // $callsite.file.IO}{$line // $callsite.line};
}

END {
Expand Down
2 changes: 1 addition & 1 deletion src/core/Int.pm
Expand Up @@ -152,7 +152,7 @@ my class Int does Real { # declared in BOOTSTRAP
my $lsb = 0;
my $x = self.abs;
while $x +& 0xff == 0 { $lsb += 8; $x +>= 8; }
while $x +& 0x01 == 0 { $lsb++; $x +>= 1; }
while $x +& 0x01 == 0 { ++$lsb; $x +>= 1; }
$lsb;
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/Lock/Async.pm
Expand Up @@ -166,7 +166,7 @@ my class Lock::Async {
}
else {
my int $n = nqp::elems($rec-list);
loop (my int $i = 0; $i < $n; $i++) {
loop (my int $i = 0; $i < $n; ++$i) {
return True if nqp::eqaddr(nqp::atpos($rec-list, $i), self);
}
False
Expand All @@ -192,7 +192,7 @@ my class Lock::Async {
else {
$new-held := nqp::list();
my int $n = nqp::elems($current);
loop (my int $i = 0; $i < $n; $i++) {
loop (my int $i = 0; $i < $n; ++$i) {
my $lock := nqp::atpos($current, $i);
nqp::push($new-held, $lock) unless nqp::eqaddr($lock, self);
}
Expand Down
8 changes: 4 additions & 4 deletions src/core/Proc.pm
Expand Up @@ -36,7 +36,7 @@ my class Proc {
$cur-promise .= then({ $!proc.close-stdin; });
self!await-if-last-handle
}));
$!active-handles++;
++$!active-handles;
$!w := True;
}
elsif nqp::istype($in, Str) && $in eq '-' {
Expand All @@ -52,7 +52,7 @@ my class Proc {
$!out = IO::Pipe.new(:proc(self), :$chomp, :$enc, :$bin, nl-in => $nl,
:on-read({ (try $chan.receive) // buf8 }),
:on-close({ self!await-if-last-handle }));
$!active-handles++;
++$!active-handles;
@!pre-spawn.push({
$!proc.stdout(:bin).merge($!proc.stderr(:bin)).act: { $chan.send($_) },
done => { $chan.close },
Expand Down Expand Up @@ -81,7 +81,7 @@ my class Proc {
&!start-stdout = Nil;
await $stdout-supply.native-descriptor
}));
$!active-handles++;
++$!active-handles;
@!pre-spawn.push({
$stdout-supply = $!proc.stdout(:bin)
});
Expand Down Expand Up @@ -119,7 +119,7 @@ my class Proc {
$!active-handles--;
await $stderr-supply.native-descriptor
}));
$!active-handles++;
++$!active-handles;
@!pre-spawn.push({
$stderr-supply = $!proc.stderr(:bin);
});
Expand Down
4 changes: 2 additions & 2 deletions src/core/Rational.pm
Expand Up @@ -87,7 +87,7 @@ my role Rational[::NuT = Int, ::DeT = ::("NuT")] does Real {
my $fract = self.abs - $whole;

# fight floating point noise issues RT#126016
if $fract.Num == 1e0 { $whole++; $fract = 0 }
if $fract.Num == 1e0 { ++$whole; $fract = 0 }

my $result = nqp::if(
nqp::islt_I($!numerator, 0), '-', ''
Expand All @@ -105,7 +105,7 @@ my role Rational[::NuT = Int, ::DeT = ::("NuT")] does Real {
$fract -= $_;
}
}
$fract-result++ if 2*$fract >= 1; # round off fractional result
++$fract-result if 2*$fract >= 1; # round off fractional result

$result ~= '.' ~ $fract-result;
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/Real.pm
Expand Up @@ -107,11 +107,11 @@ my role Real does Numeric {
for @frac_digits-1 ... 0 -> $x {
last if ++@frac_digits[$x] < $base;
@frac_digits[$x] = 0;
$int_part++ if $x == 0
++$int_part if $x == 0
}
}
else {
$int_part++;
++$int_part;
}
}
my Str $r = $int_part.base($base);
Expand Down
2 changes: 1 addition & 1 deletion src/core/Str.pm
Expand Up @@ -2692,7 +2692,7 @@ my class Str does Stringy { # declared in BOOTSTRAP
$pos -= $pos % $?TABSTOP;
$pos += $?TABSTOP;
} else {
$pos++
++$pos
}
}
if $l<indent-chars> and $pos % $?TABSTOP {
Expand Down

0 comments on commit ae6177c

Please sign in to comment.