scilla icon indicating copy to clipboard operation
scilla copied to clipboard

Design functions to fold through statements and expressions

Open jubnzv opened this issue 1 year ago • 2 comments

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.

jubnzv avatar Aug 17 '22 12:08 jubnzv

Related issue: #438

anton-trunov avatar Aug 18 '22 13:08 anton-trunov

Related: we now have an annotation mapper in https://github.com/Zilliqa/scilla/blob/master/src/base/SyntaxAnnotMapper.ml.

anton-trunov avatar Sep 13 '22 12:09 anton-trunov