summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-04-11 11:43:47 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-04-11 11:43:47 +0000
commitc81d17265e77edf44864c61b5bfc4ce8dae00061 (patch)
tree2bc9ddea691041d2a15ee2110cb642bea1ff5189
parent6dc2e6b91b88b11cb1dde2ddd1a5dee6e7d3495e (diff)
downloadperl-MDK-Common-c81d17265e77edf44864c61b5bfc4ce8dae00061.tar
perl-MDK-Common-c81d17265e77edf44864c61b5bfc4ce8dae00061.tar.gz
perl-MDK-Common-c81d17265e77edf44864c61b5bfc4ce8dae00061.tar.bz2
perl-MDK-Common-c81d17265e77edf44864c61b5bfc4ce8dae00061.tar.xz
perl-MDK-Common-c81d17265e77edf44864c61b5bfc4ce8dae00061.zip
warn things like: ($foo) ||= ...
-rw-r--r--perl_checker.src/parser_helper.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml
index 1ddeebc..696a36e 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -588,6 +588,10 @@ let call_op_((prio, (prev_ter, op)), ter, para) (sp, pos) =
warn_rule "don't do this"
else if List.exists (function Num _ -> true | _ -> false) para then
warn_rule (sprintf "you should use a number operator, not the string operator \"%s\" (or replace the number with a string)" op)
+ | "||=" | "&&=" ->
+ (match List.hd para with
+ | List [ List _ ] -> warn_rule "remove the parentheses"
+ | e -> if is_not_a_scalar e then warn_rule (sprintf "\"%s\" is only useful with a scalar" op))
| _ -> ());
sp_same prev_ter ter ;
(prio, cook_call_op(op, para, pos)), (sp, pos)