Module InferIR.AccessPath
type access=|ArrayAccess of Typ.t * t listarray element type with list of access paths in index
|FieldAccess of Typ.Fieldname.tfield name
and t= base * access listroot var, and a list of accesses. closest to the root var is first that is, x.f.g is representedas (x,
f; g)
val truncate : t -> t * access optionremove and return the last access of the access path if the access list is non-empty. returns the original access path * None if the access list is empty
val get_last_access : t -> access optionget the last access in the list. returns None if the list is empty
val get_field_and_annotation : t -> Tenv.t -> (Typ.Fieldname.t * Annot.Item.t) optionget the field name and the annotation of the last access in the list of accesses if the list is non-empty and the last access is a field access
val get_typ : t -> Tenv.t -> Typ.t optionget the typ of the last access in the list of accesses if the list is non-empty, or the base if the list is empty. that is, for x.f.g, return typ(g), and for x, return typ(x)
val of_exp : include_array_indexes:bool -> Exp.t -> Typ.t -> f_resolve_id:(Var.t -> t option) -> t listextract the access paths that occur in
exp, resolving identifiers usingf_resolve_id. don't include index expressions in array accesses ifinclude_array_indexesis false
val of_lhs_exp : include_array_indexes:bool -> Exp.t -> Typ.t -> f_resolve_id:(Var.t -> t option) -> t optionconvert
lhs_expto an access path, resolving identifiers usingf_resolve_id
val append : t -> access list -> tappend new accesses to an existing access path; e.g., `append_access x.f
g, h` produces `x.f.g.h`
val is_prefix : t -> t -> boolreturn true if
ap1is a prefix ofap2. returns true for equal access paths
val replace_prefix : prefix:t -> t -> t -> t optionval inner_class_normalize : t -> ttransform an access path that starts on "this" of an inner class but which breaks out to access outer class fields to the outermost one. Cases handled (recursively):
- (this:InnerClass* ).(this$n:OuterClassAccessor).f. ... -> (this:OuterClass* ).f . ...
- this$n.(this$m:OuterClassAccessor).f ... -> (this$m:OuterClass* ).f . ... (happens in ctrs only)
- this$n.f ... -> this.f . ... (happens in ctrs only)
val equal : t -> t -> boolval equal_base : base -> base -> boolval pp : Stdlib.Format.formatter -> t -> unitval pp_base : Stdlib.Format.formatter -> base -> unitval pp_access : Stdlib.Format.formatter -> access -> unitval pp_access_list : Stdlib.Format.formatter -> access list -> unit
module Abs : sig ... endmodule BaseMap : InferStdlib.PrettyPrintable.PPMap with type PPMap.key = base