From 6efb35871fb87060fcadc7e68ea6a35bcb17d8eb Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Mon, 5 Aug 2024 12:26:19 -0400 Subject: [PATCH] Fix parsing of visibility send Signed-off-by: Alexandre Terrasa --- lib/rbi/parser.rb | 7 +++++++ test/rbi/parser_test.rb | 1 + 2 files changed, 8 insertions(+) diff --git a/lib/rbi/parser.rb b/lib/rbi/parser.rb index 1b9fc180..31f64ca0 100644 --- a/lib/rbi/parser.rb +++ b/lib/rbi/parser.rb @@ -421,6 +421,13 @@ def visit_call_node(node) case last_node when Method, Attr last_node.visibility = parse_visibility(node.name.to_s, node) + when Send + current_scope << Send.new( + message, + parse_send_args(node.arguments), + loc: node_loc(node), + comments: node_comments(node), + ) else raise ParseError.new( "Unexpected token `#{node.message}` before `#{last_node&.string&.strip}`", diff --git a/test/rbi/parser_test.rb b/test/rbi/parser_test.rb index f8368a20..68edf8a8 100644 --- a/test/rbi/parser_test.rb +++ b/test/rbi/parser_test.rb @@ -300,6 +300,7 @@ def test_parse_arbitrary_sends class ActiveRecord::Base class_attribute :typed_stores, :store_accessors, instance_accessor: false, default: "Foo" foo bar, "bar", :bar + private :foo end RBI