[cost] Fix function name matching

Summary: `Str.regexp_string` should be used to find a method name instead of `Str.regexp`.

Reviewed By: ezgicicek

Differential Revision: D18136598

fbshipit-source-id: c4b56dd64
master
Sungkeun Cho 5 years ago committed by Facebook Github Bot
parent 3cb13bba0f
commit 96668ed7d8

@ -1136,7 +1136,7 @@ module Procname = struct
let is_infer_undefined pn =
match pn with
| Java j ->
let regexp = Str.regexp "com.facebook.infer.builtins.InferUndefined" in
let regexp = Str.regexp_string "com.facebook.infer.builtins.InferUndefined" in
Str.string_match regexp (Java.get_class_name j) 0
| _ ->
(* TODO: add cases for obj-c, c, c++ *)

@ -213,7 +213,7 @@ let issue_of_cost kind CostIssues.{complexity_increase_issue; zero_issue; infini
let file = cost_info.Jsonbug_t.loc.file in
let method_name = cost_info.Jsonbug_t.procedure_name in
let class_name =
match Str.split (Str.regexp ("." ^ method_name)) cost_info.Jsonbug_t.procedure_id with
match Str.split (Str.regexp_string ("." ^ method_name)) cost_info.Jsonbug_t.procedure_id with
| [class_name; _] ->
class_name
| _ ->

Loading…
Cancel
Save