scilla
scilla copied to clipboard
Design functions to fold through statements and expressions
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
.
Related issue: #438
Related: we now have an annotation mapper in https://github.com/Zilliqa/scilla/blob/master/src/base/SyntaxAnnotMapper.ml.