Summary: Use `Typ.t` for parameter types in procnames, instead of `JavaSplitName.t`. This allows more precise and usable types stored in procnames, as well as not using the string-based representation of `JavaSplitName` which meant parsing strings whenever one needed a `Typ.t`. This also makes `JavaSplitName` dead code, so it is removed. Reviewed By: skcho Differential Revision: D20500423 fbshipit-source-id: a72728e3fmaster
parent
d718c04816
commit
cf29bc7aa2
@ -1,41 +0,0 @@
|
||||
(*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
open! IStd
|
||||
module F = Format
|
||||
|
||||
type t = {package: string option; type_name: string} [@@deriving compare, equal]
|
||||
|
||||
let make ?package type_name = {type_name; package}
|
||||
|
||||
(** Given a package.class_name string, it looks for the latest dot and split the string in two
|
||||
(package, class_name) *)
|
||||
let of_string package_classname =
|
||||
match String.rsplit2 package_classname ~on:'.' with
|
||||
| Some (package, type_name) ->
|
||||
{type_name; package= Some package}
|
||||
| None ->
|
||||
{type_name= package_classname; package= None}
|
||||
|
||||
|
||||
let package {package} = package
|
||||
|
||||
let type_name {type_name} = type_name
|
||||
|
||||
let java_lang_object = make ~package:"java.lang" "Object"
|
||||
|
||||
let java_lang_object_array = make ~package:"java.lang" "Object[]"
|
||||
|
||||
let java_lang_string = make ~package:"java.lang" "String"
|
||||
|
||||
let java_lang_string_array = make ~package:"java.lang" "String[]"
|
||||
|
||||
let pp_type_verbosity ~verbose fmt = function
|
||||
| {package= Some package; type_name} when verbose ->
|
||||
F.fprintf fmt "%s.%s" package type_name
|
||||
| {type_name} ->
|
||||
F.pp_print_string fmt type_name
|
@ -1,38 +0,0 @@
|
||||
(*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
open! IStd
|
||||
module F = Format
|
||||
|
||||
(** Module for representing a Java type. *)
|
||||
|
||||
type t [@@deriving compare, equal]
|
||||
|
||||
val make : ?package:string -> string -> t
|
||||
|
||||
val of_string : string -> t
|
||||
(** Given a package.type_name string, it looks for the latest dot and splits the string in two
|
||||
(package, rest-of-type-name). If there is no dot symbol, assumes the whole string is a type
|
||||
name. NB the RHS is not just a classname, eg it can be an array type. *)
|
||||
|
||||
val java_lang_object : t
|
||||
(** [java.lang.Object] type *)
|
||||
|
||||
val java_lang_object_array : t
|
||||
(** [java.lang.Object\[\]] type *)
|
||||
|
||||
val java_lang_string : t
|
||||
(** [java.lang.String] type *)
|
||||
|
||||
val java_lang_string_array : t
|
||||
(** [java.lang.String\[\]] type *)
|
||||
|
||||
val package : t -> string option
|
||||
|
||||
val type_name : t -> string
|
||||
|
||||
val pp_type_verbosity : verbose:bool -> F.formatter -> t -> unit
|
Loading…
Reference in new issue