-
Notifications
You must be signed in to change notification settings - Fork 9
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
Introduce RBSSig
node
#420
Conversation
lib/rbi/model.rb
Outdated
extend T::Sig | ||
|
||
#: String | ||
attr_reader :signature |
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.
attr_reader :signature | |
attr_reader :string |
lib/rbi/model.rb
Outdated
@@ -982,6 +987,21 @@ def ==(other) | |||
end | |||
end | |||
|
|||
# RBS signatures | |||
|
|||
class RBSSig < NodeWithComments |
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'm not a fan of the name, what about CommentSig
or SigComment
?
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 don't think we want to attach comments to them
class RBSSig < NodeWithComments | |
class RBSSig < Node |
lib/rbi/printer.rb
Outdated
#: (RBSSig node) -> void | ||
def visit_rbs_sig(node) | ||
print_loc(node) | ||
printt("#") |
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.
Let's strip the :
when we create the sig so it's nicer to handle, then we add it back when we print:
printt("#") | |
printt("#:") |
147feed
to
939fdfc
Compare
lib/rbi/printer.rb
Outdated
#: (RBSSig node) -> void | ||
def visit_rbs_sig(node) | ||
print_loc(node) | ||
printt("#:") |
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.
printt("#:") | |
printt("#: ") |
test/rbi/printer_test.rb
Outdated
@@ -1166,5 +1166,15 @@ def test_print_sigs_with_final | |||
end | |||
RBI | |||
end | |||
|
|||
def test_print_rbs_sigs | |||
rbs_sig = RBSSig.new(" -> String") |
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.
rbs_sig = RBSSig.new(" -> String") | |
rbs_sig = RBSSig.new("-> String") |
939fdfc
to
0f8b48b
Compare
A simple node that's currently used for printing RBS signatures correctly.