From 53f3f4249df758f2e634b64fea69e3cd8b6f3544 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 12 Aug 2004 04:46:01 +0000 Subject: you can replace "grep { !member($_, ...) } @l" with "difference2([ @l ], [ ... ])" --- perl_checker.src/parser_helper.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'perl_checker.src/parser_helper.ml') diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml index 3700f2f..8d238ed 100644 --- a/perl_checker.src/parser_helper.ml +++ b/perl_checker.src/parser_helper.ml @@ -883,7 +883,14 @@ let call_raw force_non_builtin_func (e, para) = warn_rule "you can replace \"map { if_(..., $_) }\" with \"grep { ... }\"" | _ -> check_anonymous_block f para) - | "grep" + | "grep" -> + (match para with + | [ Anonymous_sub(None, Block [ List [ Call_op("not", [ Call(Deref(I_func, Ident(None, "member", _)), [ List(Deref(I_scalar, Ident(None, "_", _)) :: _) ]) ], _) ] ], _); _ ] -> + warn_rule "you can replace \"grep { !member($_, ...) } @l\" with \"difference2([ @l ], [ ... ])\"" + | [ Anonymous_sub(None, Block [ List [ Call(Deref(I_func, Ident(None, "member", _)), [ List(Deref(I_scalar, Ident(None, "_", _)) :: _) ]) ] ], _); _ ] -> + warn_rule "you can replace \"grep { member($_, ...) } @l\" with \"intersection([ @l ], [ ... ])\"" + | _ -> check_anonymous_block f para) + | "grep_index" | "map_index" | "partition" | "uniq_" | "find" | "any" | "every" -- cgit v1.2.1