From 86a9dd86319d36f9c67b1fbd5ff47e4216eaf74a Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Wed, 24 Jul 2024 14:36:54 -0400 Subject: [PATCH] Fix comments parsing for RBI::Method Signed-off-by: Alexandre Terrasa --- lib/rbi/parser.rb | 2 +- test/rbi/parser_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rbi/parser.rb b/lib/rbi/parser.rb index 1d311d40..8431c762 100644 --- a/lib/rbi/parser.rb +++ b/lib/rbi/parser.rb @@ -242,10 +242,10 @@ def visit_def_node(node) @last_node = node current_scope << Method.new( node.name.to_s, + comments: current_sigs_comments + node_comments(node), params: parse_params(node.parameters), sigs: current_sigs, loc: node_loc(node), - comments: current_sigs_comments + node_comments(node), is_singleton: !!node.receiver, ) @last_node = nil diff --git a/test/rbi/parser_test.rb b/test/rbi/parser_test.rb index a62674f0..f8368a20 100644 --- a/test/rbi/parser_test.rb +++ b/test/rbi/parser_test.rb @@ -720,7 +720,7 @@ module A # B comment class B # c comment - def c; end + def c(a); end # d comment attr_reader :a