ErlangFrontend.ErlangEnvironment
module Ast = ErlangAst
val sexp_of_module_name : module_name -> Sexplib0.Sexp.t
module UnqualifiedFunction : sig ... end
val sexp_of_record_field_info : record_field_info -> Sexplib0.Sexp.t
type record_info = {
field_names : string list;
field_info : record_field_info IStdlib.IString.Map.t;
}
val sexp_of_record_info : record_info -> Sexplib0.Sexp.t
type ('procdesc, 'result) t = {
cfg : IR.Cfg.t;
module_info : IR.Annot.t IStdlib.IString.Map.t;
used to store data for Module:module_info
*)current_module : module_name;
used to qualify function names
*)is_otp : bool;
does this module come from the OTP library
*)functions : UnqualifiedFunction.Set.t;
used to resolve function names
*)specs : Ast.spec UnqualifiedFunction.Map.t;
map functions to their specs
*)types : Ast.type_ IStdlib.IString.Map.t;
user defined types
*)exports : UnqualifiedFunction.Set.t;
used to determine public/private access
*)imports : module_name UnqualifiedFunction.Map.t;
used to resolve function names
*)records : record_info IStdlib.IString.Map.t;
used to get fields, indexes and initializers
*)location : IBase.Location.t;
used to tag nodes and instructions being created
*)procdesc : 'procdesc;
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