File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1607,6 +1607,7 @@ def parse_require(context, comment)
16071607 def parse_rescue
16081608 skip_tkspace false
16091609
1610+ nest = 0
16101611 while tk = get_tk
16111612 case tk
16121613 when TkNL , TkSEMICOLON then
@@ -1615,6 +1616,11 @@ def parse_rescue
16151616 skip_tkspace false
16161617
16171618 get_tk if TkNL === peek_tk
1619+ when TkLPAREN , TkfLPAREN then
1620+ nest += 1
1621+ when TkRPAREN then
1622+ nest -= 1
1623+ break if nest < 0
16181624 end
16191625
16201626 skip_tkspace false
Original file line number Diff line number Diff line change @@ -3600,6 +3600,25 @@ class C
36003600 assert_equal :public , const_c . visibility
36013601 end
36023602
3603+ def test_document_after_rescue_inside_paren
3604+ util_parser <<-RUBY
3605+ class C
3606+ attr_accessor :sample if (1.inexistent_method rescue false)
3607+ # first
3608+ # second
3609+ def a
3610+ end
3611+ end
3612+ RUBY
3613+
3614+ @parser . scan
3615+
3616+ c = @store . find_class_named 'C'
3617+
3618+ c_a = c . find_method_named 'a'
3619+ assert_equal "first\n second" , c_a . comment . text
3620+ end
3621+
36033622 def test_singleton_method_via_eigenclass
36043623 util_parser <<-RUBY
36053624class C
You can’t perform that action at this time.
0 commit comments