Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

X= operators now require RHS to be true and false.

  • Loading branch information...
commit 4aedd0879e744fc4e3fafff386f0e9d87426f311 1 parent 1018104
@pjcj authored
Showing with 12 additions and 3 deletions.
  1. +1 −0  Changes
  2. +9 −1 Cover.xs
  3. +2 −2 lib/Devel/Cover.pm
View
1  Changes
@@ -3,6 +3,7 @@ Devel::Cover history
{{$NEXT}}
- Test against 5.17.8.
- Ignore PERL5OPT during tests. And other make targets. (rt 43833).
+ - &&=, ||= and //= operators now require RHS to be true and false.
Release 1.00 - 10 February 2013
- Fix segv in constant folding of xor ops (gitbub 40).
View
10 Cover.xs
@@ -759,7 +759,14 @@ static void cover_logop(pTHX)
#if PERL_VERSION > 8
int left_val_def = SvOK(TOPs);
#endif
- int void_context = GIMME_V == G_VOID;
+ /* We don't count X= as void context because we care about the value
+ * of the RHS. */
+ int void_context = GIMME_V == G_VOID &&
+#if PERL_VERSION > 8
+ PL_op->op_type != OP_DORASSIGN &&
+#endif
+ PL_op->op_type != OP_ANDASSIGN &&
+ PL_op->op_type != OP_ORASSIGN;
NDEB(D(L, "left_val: %d, void_context: %d at %p\n",
left_val, void_context, PL_op));
NDEB(op_dump(PL_op));
@@ -797,6 +804,7 @@ static void cover_logop(pTHX)
* success.
*/
+ NDEB(D(L, "Add conditional 2\n"));
add_conditional(aTHX_ PL_op, 2);
}
else
View
4 lib/Devel/Cover.pm
@@ -968,7 +968,7 @@ sub add_condition_cover
my $name = $r->name;
$name = $r->first->name if $name eq "sassign";
# TODO - exec? any others?
- # print STDERR "Name [$name]\n";
+ # print STDERR "Name [$name]", Dumper $c;
if ($c->[5] || $name =~ $Const_right)
{
$c = [ $c->[3], $c->[1] + $c->[2] ];
@@ -980,7 +980,7 @@ sub add_condition_cover
@$c = @{$c}[$type eq "or" ? (3, 2, 1) : (3, 1, 2)];
$count = 3;
}
- # print STDERR "$type 3 $name [@$c] $File:$Line\n";
+ # print STDERR "$type 3 $name [", join(",", @$c), "] $File:$Line\n";
}
elsif ($type eq "xor")
{
Please sign in to comment.
Something went wrong with that request. Please try again.