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.
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
Changes to generate anonymous types inside parent type's namespace #109
Changes to generate anonymous types inside parent type's namespace #109
Changes from 1 commit
d32daf2
f34a3fe
06edcda
e4675b9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
We need to make a similar change to the getter, or else it will just lead to user confusion. If
setC(List<String> c)
accepts a list, thengetC()
should return a list.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.
I didn't change the getters because for an inline type that is for example a struct it would require to return the struct(e.g. check this test case of nested struct hat has a field c which is also a struct ). This will be simplified once we have
$codegen_name
or similar which will return classC
instead ofAnonymousTypeX
.Other option is to instead let all the
getX()
methods of the nested struct be part of the parent class.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.
(🗺️ PR tour) This file adds 3 new macros for generating anonymous types.
anonymous_type
: Generates a new child class for given anonymous type based on its properties (e.g.target_kind_name
,abstract_data_type
).initialize_anonymous_type
: This is helper macro to initialize anonymous types inside setter methods.define_params_for_anonymous_type
: This is helper macro to define arguments to setter methods. (This macrohelps get the base type as argument instead of anonymous type itself, check this code snippet to see how this is used)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.
Can we just get rid of the anonymous types when it's a
List<Something>
? (Is that going to be done in a different PR?)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.
Did you mean to get rid of creating a nested class which contains
List<Something>
? I have created a separate class for anonymous type with ISL like{type: list, element: int}
because there could be more constraints added to this anonymous type which might require adding more variables/APIs to this anonymous type class withList<Something>
.But I can add a check to see if there are no more constraints then the
type
andelement
then I can skip generating anonymous type for it.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.
I really like that this generates javadoc 👍