summaryrefslogtreecommitdiffstats
path: root/perl_checker.src
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-11-10 09:52:28 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-11-10 09:52:28 +0000
commit76760716b25efb7aa37b6222cbb096a7ceadb69b (patch)
treeaec0644e13d4ba664c7648710a81d65a4b9af99f /perl_checker.src
parent5a2d7c11e92680631d2e09b60120cd11a64636fd (diff)
downloadperl-MDK-Common-76760716b25efb7aa37b6222cbb096a7ceadb69b.tar
perl-MDK-Common-76760716b25efb7aa37b6222cbb096a7ceadb69b.tar.gz
perl-MDK-Common-76760716b25efb7aa37b6222cbb096a7ceadb69b.tar.bz2
perl-MDK-Common-76760716b25efb7aa37b6222cbb096a7ceadb69b.tar.xz
perl-MDK-Common-76760716b25efb7aa37b6222cbb096a7ceadb69b.zip
new warning: you can replace "member($xxx, keys %yyy)" with "exists $yyy{$xxx}"
Diffstat (limited to 'perl_checker.src')
-rw-r--r--perl_checker.src/parser_helper.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml
index 5a48a10..ac0223c 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -810,6 +810,13 @@ let call_raw is_a_func (e, para) =
| Anonymous_sub _ :: _ -> ()
| _ -> warn_rule (sprintf "always use \"%s\" with a block (eg: %s { ... } @list)" f f));
None
+
+ | "member" ->
+ (match para with
+ [ List [ _; Call(Deref(I_func, Ident(None, "keys", _)), _) ] ] ->
+ warn_rule "you can replace \"member($xxx, keys %yyy)\" with \"exists $yyy{$xxx}\""
+ | _ -> ());
+ None
| _ -> None
in Call(e, some_or para' para)