summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/parser_helper.ml
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-05-23 13:50:38 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-05-23 13:50:38 +0000
commit1cfcfd607a60a22955cacf6030ddd68ec2ee3db3 (patch)
treeea192857431cacce22c3363f8a0d802be3c486e6 /perl_checker.src/parser_helper.ml
parentfd7077b4fa1903b53aa21bbb6774e8a90cd5a29d (diff)
downloadperl-MDK-Common-1cfcfd607a60a22955cacf6030ddd68ec2ee3db3.tar
perl-MDK-Common-1cfcfd607a60a22955cacf6030ddd68ec2ee3db3.tar.gz
perl-MDK-Common-1cfcfd607a60a22955cacf6030ddd68ec2ee3db3.tar.bz2
perl-MDK-Common-1cfcfd607a60a22955cacf6030ddd68ec2ee3db3.tar.xz
perl-MDK-Common-1cfcfd607a60a22955cacf6030ddd68ec2ee3db3.zip
add warning: you can replace "map { if_(..., $_) }" with "grep { ... }"
Diffstat (limited to 'perl_checker.src/parser_helper.ml')
-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 e19dfe1..372f8a3 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -763,6 +763,10 @@ let call_func is_a_func (e, para) =
| "map" | "grep" ->
(match para with
+
+ | Anonymous_sub(None, Block [ List [ Call(Deref(I_func, Ident(None, "if_", _)),
+ [ List [ _ ; Deref(I_scalar, Ident(None, "_", _)) ] ]) ] ], _) :: _ ->
+ warn_rule "you can replace \"map { if_(..., $_) }\" with \"grep { ... }\""
| Anonymous_sub _ :: _ -> ()
| _ -> warn_rule (sprintf "always use \"%s\" with a block (eg: %s { ... } @list)" f f));
None