From 615100e55e7d283458f514103ff387fc8adc2670 Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Tue, 8 Oct 2019 07:51:45 -0700 Subject: [PATCH] [patternmatch] fix wrong regexp in getter detection Summary: The regexp would match `ge` and is also unnecessary and was compiled on every call. Save some cpu cycles while fixing it. Reviewed By: jvillard Differential Revision: D17789586 fbshipit-source-id: a3f6612c6 --- infer/src/absint/PatternMatch.ml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/infer/src/absint/PatternMatch.ml b/infer/src/absint/PatternMatch.ml index 6a6aabd67..5cb664687 100644 --- a/infer/src/absint/PatternMatch.ml +++ b/infer/src/absint/PatternMatch.ml @@ -233,9 +233,7 @@ let get_vararg_type_names tenv (call_node : Procdesc.Node.t) (ivar : Pvar.t) : s type_names [] call_node -let is_getter pname_java = - Str.string_match (Str.regexp "get*") (Typ.Procname.Java.get_method pname_java) 0 - +let is_getter pname_java = String.is_prefix ~prefix:"get" (Typ.Procname.Java.get_method pname_java) let type_is_class typ = match typ.Typ.desc with