-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
typespec/1
macro to transform module behaviour (#384)
* When module has transform_module, use it on typespec We detect that `transform_module/0` was defined through a on_definition hook. We then store the module in an attribute. This attribute is later used by the `before_compile` callback to set the typespec, which is set in the form of: ```elixir @t transform_module.t(__MODULE__) ``` Then, transform modules can implement proper typespecs. No changes if `transform_module` is not overriden. * Fix warning * Add type t/1 to transform modules * Implement new idea for typespecs on transformers * Update lib/protobuf/transform_module/infer_fields_from_enum.ex * Take a single argument in typespec macro Module is redundant. One can use __CALLER__ to retrieve the calling module env. * Address review comments * Remove comp-time error Wasn't able to make it work in the way I intended without significant refactoring, think the existing error is good enough for now.
- Loading branch information
Showing
5 changed files
with
105 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters