IR.Tenv
Module for Type Environments.
val create : unit -> t
Create a new type environment.
val load : IBase.SourceFile.t -> t option
Load a type environment for a source file
val store_debug_file_for_source : IBase.SourceFile.t -> t -> unit
val read : IBase.DB.filename -> t option
Read and return a type environment from the given file
val write : t -> IBase.DB.filename -> unit
Write the type environment into the given file
val load_global : unit -> t option
Load the global type environment (Java)
val store_global : normalize:bool -> t -> unit
Save a global type environment (Java/Hack)
val lookup : t -> Typ.Name.t -> Struct.t option
Look up a name in the given type environment.
val mk_struct :
t ->
?default:Struct.t ->
?fields:Struct.field list ->
?statics:Struct.field list ->
?methods:Procname.t list ->
?exported_objc_methods:Procname.t list ->
?supers:Typ.Name.t list ->
?objc_protocols:Typ.Name.t list ->
?annots:Annot.Item.t ->
?class_info:Struct.ClassInfo.t ->
?dummy:bool ->
?source_file:IBase.SourceFile.t ->
Typ.Name.t ->
Struct.t
Construct a struct_typ, normalizing field types
val add_field : t -> Typ.Name.t -> Struct.field -> unit
Add a field to a given struct in the global type environment.
val pp : Stdlib.Format.formatter -> t -> unit
print a type environment
val fold : t -> init:'acc -> f:(Typ.Name.t -> Struct.t -> 'acc -> 'acc) -> 'acc
val fold_supers :
?ignore_require_extends:bool ->
t ->
Typ.Name.t ->
init:'a ->
f:(Typ.Name.t -> Struct.t option -> 'a -> 'a) ->
'a
val mem_supers :
t ->
Typ.Name.t ->
f:(Typ.Name.t -> Struct.t option -> bool) ->
bool
val get_parent : t -> Typ.Name.t -> Typ.Name.t option
val find_map_supers :
?ignore_require_extends:bool ->
t ->
Typ.Name.t ->
f:(Typ.Name.t -> Struct.t option -> 'a option) ->
'a option
val get_fields_trans : t -> Typ.Name.t -> Struct.field list
Get all fields from the super classes transitively
val pp_per_file : Stdlib.Format.formatter -> per_file -> unit
print per file type environment
Best-effort merge of src
into dst
. If a procedure is both in dst
and src
, the one in dst
will get overwritten.
module MethodInfo : sig ... end
val resolve_method :
method_exists:(Procname.t -> Procname.t list -> bool) ->
t ->
Typ.Name.t ->
Procname.t ->
MethodInfo.t option * Typ.Name.Set.t
resolve_method ~method_exists tenv class_name procname
return a pair (info_opt, missed_captures)
where info_opt
tries to resolve procname
to a method in class_name
or its super-classes, that is non-virtual (non-Java-interface method). missed_captures
is the set of classnames for which the hierarchy traversal would have need to examine its members but the class was not captured. method_exists adapted_procname methods
should check if adapted_procname
(procname
but with its class potentially changed to some other_class
) is among the methods
of other_class
.
val resolve_field_info :
t ->
Typ.Name.t ->
Fieldname.t ->
Struct.field_info option
resolve_field_info tenv class_name field
tries to find the first field declaration that matches field
name (ignoring its enclosing declared type), starting from class class_name
.
val resolve_fieldname : t -> Typ.Name.t -> string -> Fieldname.t option
Similar to resolve_field_info
, but returns the resolved field name.
val find_cpp_destructor : t -> Typ.Name.t -> Procname.t option
val find_cpp_constructor : t -> Typ.Name.t -> Procname.t list
val get_hack_direct_used_traits : t -> Typ.Name.t -> HackClassName.t list
module SQLite : IBase.SqliteUtils.Data with type t = per_file