Folding through nested statements and expressions is a common pattern used almost in every static analysis.
However, this pattern is too verbose and error-prone, because a developer could forget to handle nested statements or expressions for some nodes.
We should create generic functions fold_over_stmts and fold_over_exprs in the ContractUtil.ml in the same way as fold_over_messages is implemented. These function should look into nested statements and expressions and accumulate the information as it is implemented in the argument function ~f.
Folding through nested statements and expressions is a common pattern used almost in every static analysis.
However, this pattern is too verbose and error-prone, because a developer could forget to handle nested statements or expressions for some nodes.
We should create generic functions
fold_over_stmts
andfold_over_exprs
in theContractUtil.ml
in the same way asfold_over_messages
is implemented. These function should look into nested statements and expressions and accumulate the information as it is implemented in the argument function~f
.