Solidity_postcheck_utils
1 Type definitions
type fun_params =
(Solidity_checker_TYPES.type_ * Solidity_common.Ident.t option) list
type ast_annot = Solidity_common.annot * Solidity_common.pos
type expr_details = {
ed_read : ast_annot list Solidity_common.IdentMap.t;
ed_writ : ast_annot list Solidity_common.IdentMap.t;
ed_fun_calls : (fun_params * ast_annot) list Solidity_common.IdentMap.t;
ed_deep_writ : ast_annot list Solidity_common.IdentMap.t;
ed_read_access : Solidity_common.pos list;
ed_writ_state : Solidity_common.pos list;
}
type fun_kind =
| Modifier of Solidity_ast.modifier_definition
| Method of Solidity_ast.function_definition * string
| Getter of Solidity_ast.state_variable_definition
type global_details = {
gd_def : global_def;
gd_mutab : Solidity_ast.var_mutability;
mutable gd_updates : ast_annot list;
}
type function_details = {
fd_details : expr_details;
fd_kind : fun_kind;
fd_purity : Solidity_ast.fun_mutability;
fd_defined : bool;
fd_modifiers : (fun_params * modifier_details) list
Solidity_common.AbsLongIdentMap.t;
}
type contract_env = {
env_funs : (fun_params * function_details) list Solidity_common.IdentMap.t;
env_glob : global_details Solidity_common.IdentMap.t;
env_inherited : (Solidity_common.absolute Solidity_common.LongIdent.t
* contract_env)
list;
env_ctr : Solidity_ast.contract_definition;
}
type env = contract_env Solidity_common.AbsLongIdentMap.t
2. Exceptions raised by the postprocessor
val failOnAnnot : Solidity_common.annot -> 'a
3 Miscellaneous
val identmap_add_list_unique :
('a -> 'a -> bool) ->
Solidity_common.IdentMap.key ->
('a * 'b) ->
('a * 'b) list Solidity_common.IdentMap.t ->
('a * 'b) list Solidity_common.IdentMap.t
val longidentmap_add_list :
Solidity_common.AbsLongIdentMap.key ->
'a ->
'a list Solidity_common.AbsLongIdentMap.t ->
'a list Solidity_common.AbsLongIdentMap.t
val typeOf : 'a Solidity_common.node -> Solidity_checker_TYPES.type_
val identmap_list_partition :
(Solidity_common.IdentMap.key -> 'a -> bool) ->
'a list Solidity_common.IdentMap.t ->
'a list Solidity_common.IdentMap.t * 'a list Solidity_common.IdentMap.t
3.5 Utils on previously defined types
val empty_expr_details : expr_details
val empty_contract_env : Solidity_ast.contract_definition -> contract_env
val empty_project_env : env
val equalParams : check_ident:bool -> fun_params -> fun_params -> bool
val equalSortedParams : fun_params -> fun_params -> bool
val addContractEnv :
Solidity_common.absolute Solidity_common.LongIdent.t ->
contract_env ->
env ->
env
val getInInherited :
(contract_env -> 'a option) ->
contract_env ->
(Solidity_common.absolute Solidity_common.LongIdent.t * 'a) option
val getInEnv :
?in_inherited:bool ->
(contract_env -> 'a option) ->
contract_env ->
('a * Solidity_common.absolute Solidity_common.LongIdent.t option) option
val getGlobal :
?in_inherited:bool ->
Solidity_common.IdentMap.key ->
contract_env ->
(global_details * Solidity_common.absolute Solidity_common.LongIdent.t option)
option
val getFun :
?in_inherited:bool ->
fun_identity ->
contract_env ->
((fun_params * function_details)
* Solidity_common.absolute Solidity_common.LongIdent.t option)
option
val fromCurrentContract :
Solidity_common.absolute Solidity_common.LongIdent.t ->
Solidity_common.absolute Solidity_common.LongIdent.t ->
Solidity_common.Ident.t list option
val paramsFromExprs :
Solidity_ast.expression list ->
(Solidity_checker_TYPES.type_ * 'a option) list
val getFunInEnvs :
Solidity_common.absolute Solidity_common.LongIdent.t ->
fun_params ->
env ->
(fun_identity * function_details) option
val getFunAtCall :
?in_inherited:bool ->
Solidity_common.Ident.t ->
Solidity_ast.function_call_arguments ->
contract_env ->
((fun_params * function_details)
* Solidity_common.absolute Solidity_common.LongIdent.t option)
option
val iterBySelector :
(Solidity_common.absolute Solidity_common.LongIdent.t option ->
Solidity_ast.function_definition ->
unit) ->
string ->
contract_env ->
unit
val getVisibility : fun_kind -> Solidity_ast.visibility
val is_constructor : Solidity_ast.function_definition -> bool
val addFun :
Solidity_ast.ident ->
fun_params ->
function_details ->
contract_env ->
contract_env
val pp_ident_map :
(Stdlib.Format.formatter -> 'a -> unit) ->
Stdlib.Format.formatter ->
'a Solidity_common.IdentMap.t ->
unit
val pp_longident_map :
(Stdlib.Format.formatter -> 'a -> unit) ->
Stdlib.Format.formatter ->
'a Solidity_common.AbsLongIdentMap.t ->
unit
val pp_expr_details : Stdlib.Format.formatter -> expr_details -> unit
val pp_global_def : Stdlib.Format.formatter -> global_def -> unit
val pp_mutab : Stdlib.Format.formatter -> Solidity_ast.var_mutability -> unit
val pp_global_details : Stdlib.Format.formatter -> global_details -> unit
val pp_fun_details : Stdlib.Format.formatter -> function_details -> unit
val pp_ident : Stdlib.Format.formatter -> Solidity_common.Ident.t -> unit
val pp_fun_params :
Stdlib.Format.formatter ->
(Solidity_checker_TYPES.type_ * Solidity_common.Ident.t option) list ->
unit
val pp_env : Stdlib.Format.formatter -> contract_env -> unit
val (--) :
'a Solidity_common.IdentMap.t ->
Solidity_common.IdentMap.key ->
'a Solidity_common.IdentMap.t
val (+++) :
'a list Solidity_common.IdentMap.t ->
'a list Solidity_common.IdentMap.t ->
'a list Solidity_common.IdentMap.t
val (---) :
'a Solidity_common.IdentMap.t ->
'b Solidity_common.IdentMap.t ->
'a Solidity_common.IdentMap.t
val unionAssignDetails : expr_details -> expr_details -> expr_details
val removeFromAssignDetails :
'a Solidity_common.IdentMap.t ->
expr_details ->
expr_details
val addWrit :
Solidity_common.IdentMap.key Solidity_common.node ->
expr_details ->
expr_details
val addRead :
Solidity_common.IdentMap.key Solidity_common.node ->
expr_details ->
expr_details
val addFunc : fun_identity -> ast_annot -> expr_details -> expr_details
val isVirtual : function_details -> contract_env -> bool
val isConstructor : function_details -> bool
val getName : function_details -> Solidity_ast.ident
val sortContractParts :
Solidity_ast.contract_part Solidity_common.node list ->
Solidity_ast.contract_part Solidity_common.node list
val getAbsoluteContractName :
'a Solidity_common.node ->
Solidity_common.absolute Solidity_common.LongIdent.t
val minPurity :
Solidity_ast.fun_mutability ->
Solidity_ast.fun_mutability ->
Solidity_ast.fun_mutability
val purityToString : Solidity_ast.fun_mutability -> string
val purity : Solidity_ast.function_definition -> Solidity_ast.fun_mutability
val callablePurity :
Solidity_ast.fun_mutability ->
Solidity_ast.fun_mutability ->
bool
4. Analysers
val variablesInExpression :
Solidity_ast.expression ->
ast_annot list Solidity_common.IdentMap.t
* ast_annot list Solidity_common.IdentMap.t
val getExpressionDetails : Solidity_ast.expression -> expr_details
val isInherited :
Solidity_common.absolute Solidity_common.LongIdent.t ->
Solidity_ast.contract_definition ->
bool
val getterOfVariable :
Solidity_ast.state_variable_definition ->
Solidity_common.pos ->
expr_details
val getOverriddenContracts :
contract_env ->
Solidity_ast.ident ->
fun_params ->
Solidity_ast.visibility option ->
Solidity_ast.visibility Solidity_common.IdentMap.t
val getDetails :
contract_env ->
fun_kind ->
fun_params ->
Solidity_common.pos ->
function_details
val inheritFrom :
Solidity_common.absolute Solidity_common.LongIdent.t ->
contract_env ->
env ->
contract_env