Skip to content

Commit 35e3f28

Browse files
authored
Clean up CodeGenerator by moving compilation-global data and logic to Context (#1190)
* refactor(prost-build): Context Move global context data and logic around it from CodeGenerator to a new Context struct. Also move the logic of can_message_derive_copy and can_field_derive_copy from MessageGraph where it caused some data duplication. * chore: make CodeGenerator::generate crate-private It was not obvious immediately from the declaration that CodeGenerator is private to the crate. * docs(prost-build): life of Context, CodeGenerator Add doc comments clarifying the lifetime of `Context` and `CodeGenerator` in the code generation process. * refactor: CodeGenerator::config helper * refactor: rename Context::service_generator Rename to service_generator_mut so it's evident that we are obtaining a mutable reference even though the Context reference is shared. * chore: revert can_message_derive_copy behavior Avoid behavioral changes in the Context refactoring. * chore: revert should_disable_comments behavior Avoid behavioral changes in the Context refactoring. * chore: elide a lifetime in CodeGenerator impl To please clippy.
1 parent 6445907 commit 35e3f28

File tree

5 files changed

+329
-198
lines changed

5 files changed

+329
-198
lines changed

0 commit comments

Comments
 (0)