From f195e07e4d7585367905ce8bfac776e176a0b670 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 23 May 2003 13:50:38 +0000 Subject: add warning: you can replace "map { if_(..., $_) }" with "grep { ... }" --- perl_checker.src/parser_helper.ml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'perl_checker.src') 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 -- cgit v1.2.1