Skip to content

Commit

Permalink
$x++ should never return undef (fixes #81)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Dec 13, 2011
1 parent 758356b commit 8114adc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Builtins.cs
Expand Up @@ -1450,6 +1450,8 @@ public partial class Builtins {
public static Variable postinc(Variable v) {
P6any o1 = v.Fetch();
AssignV(v, o1.mo.mro_succ.Get(v));
if (!o1.IsDefined()) // note: slightly wrong for my Bool $x; $x++
o1 = Kernel.BoxRaw<int>(0, Kernel.IntMO);
return Kernel.NewROScalar(o1);
}

Expand All @@ -1461,6 +1463,8 @@ public partial class Builtins {
public static Variable postdec(Variable v) {
P6any o1 = v.Fetch();
AssignV(v, o1.mo.mro_pred.Get(v));
if (!o1.IsDefined()) // note: slightly wrong for my Bool $x; $x--
o1 = Kernel.BoxRaw<int>(0, Kernel.IntMO);
return Kernel.NewROScalar(o1);
}

Expand Down

0 comments on commit 8114adc

Please sign in to comment.