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
commit26be6f3a623b133c7ff87c907e7a5fb012119960 (patch)
treecf5f363e0c8579d3b1a2d5845a6cc7a0a9b3b153 /perl_checker.src/parser_helper.ml
parent1cfcfd607a60a22955cacf6030ddd68ec2ee3db3 (diff)
downloadperl-MDK-Common-26be6f3a623b133c7ff87c907e7a5fb012119960.tar
perl-MDK-Common-26be6f3a623b133c7ff87c907e7a5fb012119960.tar.gz
perl-MDK-Common-26be6f3a623b133c7ff87c907e7a5fb012119960.tar.bz2
perl-MDK-Common-26be6f3a623b133c7ff87c907e7a5fb012119960.tar.xz
perl-MDK-Common-26be6f3a623b133c7ff87c907e7a5fb012119960.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 =