diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-10-01 14:54:30 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-10-01 14:54:30 +0000 |
commit | be8f7e12a07c1f69d159516c08760b686d9d3b31 (patch) | |
tree | 2fe91f89cefff143aef5e7d1c302957effb52871 /perl_checker.src | |
parent | 10921a1e8b0655e388d9129c73534d2f16807c75 (diff) | |
download | perl-MDK-Common-be8f7e12a07c1f69d159516c08760b686d9d3b31.tar perl-MDK-Common-be8f7e12a07c1f69d159516c08760b686d9d3b31.tar.gz perl-MDK-Common-be8f7e12a07c1f69d159516c08760b686d9d3b31.tar.bz2 perl-MDK-Common-be8f7e12a07c1f69d159516c08760b686d9d3b31.tar.xz perl-MDK-Common-be8f7e12a07c1f69d159516c08760b686d9d3b31.zip |
also disallow map {...} %xxx
Diffstat (limited to 'perl_checker.src')
-rw-r--r-- | perl_checker.src/parser_helper.ml | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml index d12a43e..5a48a10 100644 --- a/perl_checker.src/parser_helper.ml +++ b/perl_checker.src/parser_helper.ml @@ -794,12 +794,19 @@ let call_raw is_a_func (e, para) = Some(Call_op("qr//", pattern, pos) :: l) | _ -> None) - | "map" | "grep" -> + | "map" | "grep" | "grep_index" | "map_index" | "partition" + | "find" + | "any" | "every" + | "find_index" + | "each_index" -> (match para with | Anonymous_sub(None, Block [ List [ Call(Deref(I_func, Ident(None, "if_", _)), - [ List [ _ ; Deref(I_scalar, Ident(None, "_", _)) ] ]) ] ], _) :: _ -> + [ List [ _ ; Deref(I_scalar, Ident(None, "_", _)) ] ]) ] ], _) :: _ when f = "map" -> warn_rule "you can replace \"map { if_(..., $_) }\" with \"grep { ... }\"" + | [ Anonymous_sub _ ; Deref (I_hash, _) ] -> + warn_rule ("a hash is not a valid parameter to function " ^ f) + | Anonymous_sub _ :: _ -> () | _ -> warn_rule (sprintf "always use \"%s\" with a block (eg: %s { ... } @list)" f f)); None |