-
-
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
Method/macro parameter annotation support #12044
Changes from 3 commits
e9272bd
07facde
76e0fe3
f7adb11
527585d
1e71de0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1010,8 +1010,9 @@ module Crystal | |
property default_value : ASTNode? | ||
property restriction : ASTNode? | ||
property doc : String? | ||
property parsed_annotations : Array(Annotation)? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of keeping the annotations on each arg, I think we can move this to the But we could do this refactor later on if we see memory issues. I just don't think that annotations on args will be that common, and so adding this overhead to every arg instead of adding just a nilable attribute to |
||
|
||
def initialize(@name : String, @default_value : ASTNode? = nil, @restriction : ASTNode? = nil, external_name : String? = nil) | ||
def initialize(@name : String, @default_value : ASTNode? = nil, @restriction : ASTNode? = nil, external_name : String? = nil, @parsed_annotations : Array(Annotation)? = nil) | ||
@external_name = external_name || @name | ||
end | ||
|
||
|
@@ -1025,10 +1026,10 @@ module Crystal | |
end | ||
|
||
def clone_without_location | ||
Arg.new @name, @default_value.clone, @restriction.clone, @external_name.clone | ||
Arg.new @name, @default_value.clone, @restriction.clone, @external_name.clone, @parsed_annotations.clone | ||
end | ||
|
||
def_equals_and_hash name, default_value, restriction, external_name | ||
def_equals_and_hash name, default_value, restriction, external_name, parsed_annotations | ||
end | ||
|
||
# The Proc notation in the type grammar: | ||
|
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.
Related: #5334