summaryrefslogtreecommitdiffstats
path: root/perl_checker.src
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
commitae6b72622f6b2954f44f71e24f870e5ee22ffe47 (patch)
tree2b741ead193e0a94239ca722837dc6a9c6749827 /perl_checker.src
parent70f90fe903b132a6494a1193ff14e0fbec6c173f (diff)
downloadperl_checker-ae6b72622f6b2954f44f71e24f870e5ee22ffe47.tar
perl_checker-ae6b72622f6b2954f44f71e24f870e5ee22ffe47.tar.gz
perl_checker-ae6b72622f6b2954f44f71e24f870e5ee22ffe47.tar.bz2
perl_checker-ae6b72622f6b2954f44f71e24f870e5ee22ffe47.tar.xz
perl_checker-ae6b72622f6b2954f44f71e24f870e5ee22ffe47.zip
warn things like: ($foo) ||= ...
Diffstat (limited to 'perl_checker.src')
-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)