File tree Expand file tree Collapse file tree 4 files changed +34
-2
lines changed
Expand file tree Collapse file tree 4 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ def initialize(type, node)
1616
1717 def format ( q )
1818 q . group do
19+ if node . respond_to? ( :visibility ) && node . visibility
20+ q . text ( "#{ node . visibility } " )
21+ end
22+
1923 q . text ( "attr_#{ type } " )
2024 q . text ( "self." ) if node . kind == :singleton
2125 q . text ( node . name )
@@ -43,6 +47,12 @@ def pretty_print(q)
4347 q . text ( "name=" )
4448 q . pp ( node . name )
4549
50+ if node . respond_to? ( :visibility ) && node . visibility
51+ q . breakable
52+ q . text ( "visibility=" )
53+ q . pp ( node . visibility )
54+ end
55+
4656 unless node . ivar_name . nil?
4757 q . breakable
4858 q . text ( "ivar_name=" )
@@ -281,6 +291,10 @@ def format(q)
281291 SyntaxTree ::RBS ::Annotations . maybe_format ( q , annotations )
282292
283293 q . group do
294+ if respond_to? ( :visibility ) && visibility
295+ q . text ( "#{ visibility } " )
296+ end
297+
284298 q . text ( "def " )
285299
286300 if kind == :singleton
@@ -332,6 +346,12 @@ def pretty_print(q)
332346 q . text ( "name=" )
333347 q . pp ( name )
334348
349+ if respond_to? ( :visibility ) && visibility
350+ q . breakable
351+ q . text ( "visibility=" )
352+ q . pp ( visibility )
353+ end
354+
335355 if overload?
336356 q . breakable
337357 q . text ( "overload" )
Original file line number Diff line number Diff line change @@ -26,3 +26,7 @@ prepend Foo
2626extend Foo
2727private
2828public
29+ private attr_accessor foo: Foo
30+ private attr_accessor foo(@bar): Foo
31+ public attr_accessor foo(): Foo
32+ public attr_writer self.foo(@bar): Foo
Original file line number Diff line number Diff line change @@ -15,3 +15,7 @@ def t: ?{ -> void } -> void
1515def `self`: -> void
1616def `: -> void
1717def t: (untyped `untyped`) -> void
18+ private def t: -> ("a" | "b" | "c")
19+ private def self.t: -> void | ...
20+ public def t: -> ("a" & ("b" | "c"))?
21+ public def t: (untyped `untyped`) -> void
Original file line number Diff line number Diff line change @@ -85,7 +85,9 @@ class T
8585 "include Foo" ,
8686 "@foo: String" ,
8787 "def t: (T t) -> void" ,
88- "prepend Foo"
88+ "prepend Foo" ,
89+ "private def t: (T t) -> void" ,
90+ "public attr_accessor foo: Foo" ,
8991 ]
9092
9193 test_fixtures ( "members_with_comments" , fixtures ) do |fixture |
@@ -127,7 +129,9 @@ class T
127129 "extend Foo" ,
128130 "include Foo" ,
129131 "def t: (T t) -> void" ,
130- "prepend Foo"
132+ "prepend Foo" ,
133+ "private def t: (T t) -> void" ,
134+ "public attr_accessor foo: Foo" ,
131135 ]
132136
133137 test_fixtures ( "members_with_annotations" , fixtures ) do |fixture |
You can’t perform that action at this time.
0 commit comments