epfl-lara / rust-stainless

An experimental Rust frontend for Stainless
Apache License 2.0
6 stars 2 forks source link

Refactor expression extraction to self-contained module #128

Closed yannbolliger closed 3 years ago

yannbolliger commented 3 years ago

The expr.rs file/module became longer and longer with every PR, code was not discoverable at all. After observing, that the only function used on the outside of the module was expr::extract_expr, I refactored the entire module to a self-contained and hopefully a lot more structured package.

The public (pub(super)) interface of the entire expr module is now:

That is all, outsiders need to know and see. Inside the module, the same structure was applied: logical units were split off in separate files that expose only 1-3 pub(super) methods; hiding all the details.

This new structure should make it far more easy to discover, where something is done and also will maybe even pave the way for using traits for extraction instead of a huge pattern match (see also #114).

Otherwise, the PR does not change or add any functionality.