Module ErlangFrontend.ErlangEnvironment

module Ast = ErlangAst
type module_name = string
val sexp_of_module_name : module_name -> Sexplib0.Sexp.t
type absent =
  1. | Absent
type 'a present =
  1. | Present of 'a
module UnqualifiedFunction : sig ... end
type record_field_info = {
  1. index : int;
  2. initializer_ : Ast.expression option;
}
val sexp_of_record_field_info : record_field_info -> Sexplib0.Sexp.t
type record_info = {
  1. field_names : string list;
  2. field_info : record_field_info IStdlib.IString.Map.t;
}
val sexp_of_record_info : record_info -> Sexplib0.Sexp.t
type ('procdesc, 'result) t = {
  1. cfg : IR.Cfg.t;
  2. module_info : IR.Annot.t IStdlib.IString.Map.t;
    (*

    used to store data for Module:module_info

    *)
  3. current_module : module_name;
    (*

    used to qualify function names

    *)
  4. is_otp : bool;
    (*

    does this module come from the OTP library

    *)
  5. functions : UnqualifiedFunction.Set.t;
    (*

    used to resolve function names

    *)
  6. specs : Ast.spec UnqualifiedFunction.Map.t;
    (*

    map functions to their specs

    *)
  7. types : Ast.type_ IStdlib.IString.Map.t;
    (*

    user defined types

    *)
  8. exports : UnqualifiedFunction.Set.t;
    (*

    used to determine public/private access

    *)
  9. imports : module_name UnqualifiedFunction.Map.t;
    (*

    used to resolve function names

    *)
  10. records : record_info IStdlib.IString.Map.t;
    (*

    used to get fields, indexes and initializers

    *)
  11. location : IBase.Location.t;
    (*

    used to tag nodes and instructions being created

    *)
  12. procdesc : 'procdesc;
  13. result : 'result;
}

This data structure holds module-level information and other global data that we pass around when translating individual functions of the module.

val sexp_of_t : ('procdesc -> Sexplib0.Sexp.t) -> ('result -> Sexplib0.Sexp.t) -> ('procdesc, 'result) t -> Sexplib0.Sexp.t
val initialize_environment : Ast.form list -> IStdlib.IString.Set.t -> (absent, absent) t

Entry point: go through the top-level forms in the module and initialize the environment.

val typ_of_name : IR.ErlangTypeName.t -> IR.Typ.t
val ptr_typ_of_name : IR.ErlangTypeName.t -> IR.Typ.t
val func_procname : (_, _) t -> Ast.function_ -> UnqualifiedFunction.t * IR.Procname.t
val has_type_instr : ('a, 'b) t -> result:IR.Ident.t -> value:IR.Exp.t -> IR.ErlangTypeName.t -> IR.Sil.instr

Create an instruction that stores in a result if a given value has a given type.

val procname_for_user_type : module_name -> module_name -> IR.Procname.t
val load_field_from_expr : ('a, 'b) t -> IR.Ident.t -> IR.Exp.t -> module_name -> IR.ErlangTypeName.t -> IR.Sil.instr

Create an instruction into_id=expr.field_name