Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Move static method
FileGenerator._getDeclaredMixinsto the end of the fileas a top-level function.
This is a utility method but it came first in the class and it's quite large
(~90 lines). Move it to the end so that it will allow top-down reading of the
class and won't obstruct more important details like fields.
Refactor import prefix generation: currently if I'm importing
containerinfile, I need to docontainer.importPrefix(context: file). This isconfusing and it took me a while to figure out what it's doing: It's a method
on the container type but it modifies the file. Files can import, not
containers. So files should have import prefixes, not containers.
Move the method to
FileGenerator. The code above now looks likefile.importPrefix(container).Also document the fact that just generating the import prefix for an imported
thing does not make it imported automatically. This is quite error prone, if
I call
file.importPrefix(container)and use the prefix in e.g.EnumGenerator, I need to make sure to updateFileGeneratorto actuallygenerate the import.
It would be good to refactor this so that just using an prefix is enough to
import it. But for now this part is not done.
Minor changes: use spread syntax instead of
[]..addAll(...)and similar.Add one line space between some of the fields.