diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-11-10 09:52:28 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-11-10 09:52:28 +0000 |
commit | 597ac00593cb7674c29dde36454746861b7bc1ff (patch) | |
tree | 10e8cf1eab38f49b054d703428923fa12f4a67a6 | |
parent | 6d20037c5480bd51ab88e227feb7f69b3ce1825d (diff) | |
download | perl_checker-597ac00593cb7674c29dde36454746861b7bc1ff.tar perl_checker-597ac00593cb7674c29dde36454746861b7bc1ff.tar.gz perl_checker-597ac00593cb7674c29dde36454746861b7bc1ff.tar.bz2 perl_checker-597ac00593cb7674c29dde36454746861b7bc1ff.tar.xz perl_checker-597ac00593cb7674c29dde36454746861b7bc1ff.zip |
new warning: you can replace "member($xxx, keys %yyy)" with "exists $yyy{$xxx}"
-rw-r--r-- | perl_checker.src/parser_helper.ml | 7 |
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) |