summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/parser_helper.ml
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-05-23 13:55:09 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-05-23 13:55:09 +0000
commitcd5f0719c7562fed6f0c9c4f51f3b318ae9e5911 (patch)
tree23e7539a91e5d021c2231f58c966e16499a23653 /perl_checker.src/parser_helper.ml
parentf195e07e4d7585367905ce8bfac776e176a0b670 (diff)
downloadperl_checker-cd5f0719c7562fed6f0c9c4f51f3b318ae9e5911.tar
perl_checker-cd5f0719c7562fed6f0c9c4f51f3b318ae9e5911.tar.gz
perl_checker-cd5f0719c7562fed6f0c9c4f51f3b318ae9e5911.tar.bz2
perl_checker-cd5f0719c7562fed6f0c9c4f51f3b318ae9e5911.tar.xz
perl_checker-cd5f0719c7562fed6f0c9c4f51f3b318ae9e5911.zip
fix detection of grep in scalar context
Diffstat (limited to 'perl_checker.src/parser_helper.ml')
-rw-r--r--perl_checker.src/parser_helper.ml7
1 files changed, 4 insertions, 3 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml
index 372f8a3..57d65e5 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -982,9 +982,10 @@ let mcontext_check_raw wanted_mcontext esp f_lower f_greater f_err =
f_err())
let mcontext_check wanted_mcontext esp =
- (match un_parenthesize_full esp.any.expr with
- | Call(Deref(I_func, Ident(None, "grep", _)), _) -> warn_rule "in scalar context, use \"any\" instead of \"grep\""
- | _ -> ());
+ if wanted_mcontext <> M_list && wanted_mcontext <> M_array then
+ (match un_parenthesize_full esp.any.expr with
+ | Call(Deref(I_func, Ident(None, "grep", _)), _) -> warn_rule "in scalar context, use \"any\" instead of \"grep\""
+ | _ -> ());
mcontext_check_raw wanted_mcontext esp (fun () -> ()) (fun () -> ()) (fun () -> ())
let mcontext_symops wanted_mcontext esp1 esp2 =