From ae6b72622f6b2954f44f71e24f870e5ee22ffe47 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 11 Apr 2003 11:43:47 +0000 Subject: warn things like: ($foo) ||= ... --- perl_checker.src/parser_helper.ml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'perl_checker.src') 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) -- cgit v1.2.1