-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add MetaVar#defualt_value
and MetaVar#has_default_value?
#5974
Add MetaVar#defualt_value
and MetaVar#has_default_value?
#5974
Conversation
Small note: I didn't want to make |
@asterite Do |
end | ||
|
||
def class_desc | ||
"MetaVar" |
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.
Shouldn't this return "MetaMacroVar"
?
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.
No, for the user this is the old MetaVar
@straight-shoota that's the reason why An uninitialized variable doesn't have a default value. |
@asterite Wouldn't var initialized with crystal/src/compiler/crystal/macros/methods.cr Lines 1068 to 1071 in 2f2c04f
|
|
Fixes #4387
After this, my idea is to implement some form of meta attribute to be able to implement JSON/YAML/others serialization in a much better, extensible way. So this is just the first step towards that, because one needs to know whether an instance variable has a default value, so if it's not present in the document, when mapping, one should not error.