-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Analyzer changes #2378
Analyzer changes #2378
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable!
I changed 'local
to 'run
, just cause that's used elsewhere for a second, shorter lifetime for runtime data.
Can it be refactored so that the main function takes self? I'd prefer that a little over having a local variable Analyzer in scope named analyzer
.
Can definitions
be a variable on Analyzer
, so define()
can be a method and we can avoid an additional newtype?
c03e432
to
5864753
Compare
* move the sets Table to an in-scope variable since it needs to be moved first to compute settings.allow_duplicate_recipes
5864753
to
e8218bc
Compare
I think this is possible, but that would require going back to the pattern where there's a (public) |
I think I prefer having a function and a method, so that we can use |
Is this ready to look at again? GitHub notifies on pushes, but I don't know if a push means "ready to review". |
Ah yeah, it is, I think I've addressed everything. |
Overall I feel like these changes are kind of a wash. I like moving |
Feel free to keep whatever code you think is worth merging out of this PR and get rid of the rest. The main thing that was bugging me was that the initial iteration over the AST items was modifying some variables in local scope and some variables on |
Merged! I did a little fiddling and got rid of one of the temporaries. |
This is a refactoring commit to the analyzer code that hopefully makes it easier to understand what the analyzer is doing.
Analyzer::analyze()
now instantiates anAnalyzer
, and all of the data structures containing items have been moved to being members of thatAnalyzer
struct, rather than some being on the struct and accessed throughself
and others being bare variables in the function scope.The
definitions
HashMap is moved to being a field on theAnalyzer
struct, rather than using a closure defined in function scope.analyze_set
is moved to being an associated function so it works the same way as the otheranalyze_*
functions.