rizinorg / rz-rzilcompiler

C to RZIL Compiler to extend the Rizin Hexagon plugin.
4 stars 2 forks source link

Bind local vars to their compound stmt #11

Closed Rot127 closed 2 years ago

Rot127 commented 2 years ago

Local vars should be bound to their compound statement they are used. ILHolder can simply count up an id whenever the compound list is consumed. If the transformer encounters a local var it should check, if the var id is already bound to another compound list (and therefore is out of scope).

Very important if for loops initialize i twice. The seconds for loop could use the previous i if the scope/compound membership is not checked.

Rot127 commented 2 years ago

block_item_list is handles compounds now. Statements which consume compounds use flatten_list to get all statements and expressions from a compound.