Skip to content

Refactor and show parse errors

Federico Mena Quintero requested to merge federico/gdiceroller:refactor into master

The first commits refactor the code so that there are much fewer clone()s, and so that the GUI state is nicely encapsulated. With this, the callbacks just need strong references to the GUI and the State. (In the future this makes it possible to shove the State into a state: RefCell<State> inside MainWindow, but I don't know if you want to keep them separate.)

The middle commits make State and roll_expression() testable. The idea is that roll_expression() is just a wrapper to extract data out of rfyl, and State actually encodes GUI behavior when there are parse errors in the roll expression.

The last commits make it possible to show the actual parse error in the popover.

Merge request reports