Module IR.Struct

module F = Stdlib.Format
type field = Fieldname.t * Typ.t * Annot.Item.t
val compare_field : field -> field -> int
val equal_field : field -> field -> bool
type java_class_kind =
  1. | Interface
  2. | AbstractClass
  3. | NormalClass
val equal_java_class_kind : java_class_kind -> java_class_kind -> bool
type hack_class_kind =
  1. | Class
  2. | Interface
  3. | Trait
module ClassInfo : sig ... end
type t = private {
  1. fields : field list;
    (*

    non-static fields

    *)
  2. statics : field list;
    (*

    static fields

    *)
  3. supers : Typ.Name.t list;
    (*

    superclasses

    *)
  4. objc_protocols : Typ.Name.t list;
    (*

    ObjC protocols

    *)
  5. methods : Procname.t list;
    (*

    methods defined

    *)
  6. exported_objc_methods : Procname.t list;
    (*

    methods in ObjC interface, subset of methods

    *)
  7. annots : Annot.Item.t;
    (*

    annotations

    *)
  8. class_info : ClassInfo.t;
    (*

    present if and only if the class is Java or Hack

    *)
  9. dummy : bool;
    (*

    dummy struct for class including static method

    *)
  10. source_file : IBase.SourceFile.t option;
    (*

    source file containing this struct's declaration

    *)
}

Type for a structured value.

val hash_normalize : t -> t
val hash_normalize_opt : t option -> t option
val hash_normalize_list : t list -> t list
type lookup = Typ.Name.t -> t option
val pp_field : IStdlib.Pp.env -> F.formatter -> field -> unit
val pp : IStdlib.Pp.env -> Typ.Name.t -> F.formatter -> t -> unit

Pretty print a struct type.

val internal_mk_struct : ?default:t -> ?fields:field list -> ?statics: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:ClassInfo.t -> ?dummy:bool -> ?source_file:IBase.SourceFile.t -> Typ.name -> t

Construct a struct_typ, normalizing field types

val get_extensible_array_element_typ : lookup:lookup -> Typ.t -> Typ.t option

the element typ of the final extensible array in the given typ, if any

type field_info = {
  1. typ : Typ.t;
  2. annotations : Annot.Item.t;
  3. is_static : bool;
}
val get_field_info : lookup:lookup -> Fieldname.t -> Typ.t -> field_info option

Lookup for info associated with the field fn. None if typ has no field named fn

val fld_typ_opt : lookup:lookup -> Fieldname.t -> Typ.t -> Typ.t option

If a struct type with field f, return Some (the type of f). If not, return None.

val fld_typ : lookup:lookup -> default:Typ.t -> Fieldname.t -> Typ.t -> Typ.t

If a struct type with field f, return the type of f. If not, return the default type if given, otherwise raise an exception

val get_field_type_and_annotation : lookup:lookup -> Fieldname.t -> Typ.t -> (Typ.t * Annot.Item.t) option

Return the type of the field fn and its annotation, None if typ has no field named fn

val merge : Typ.Name.t -> newer:t -> current:t -> t

best effort directed merge of two structs for the same typename

val is_not_java_interface : t -> bool

check that a struct either defines a non-java type, or a non-java-interface type (abstract or normal class)

val get_source_file : t -> IBase.SourceFile.t option
val is_hack_class : t -> bool
val is_hack_interface : t -> bool
val is_hack_trait : t -> bool