From 3459901665584cb9d3d50adbbd278b819b1aa13a Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Sat, 16 Apr 2022 12:58:31 -0400 Subject: [PATCH] foo::(1) --- lib/syntax_tree/parser.rb | 10 ++++++++-- test/fixtures/call.rb | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/call.rb diff --git a/lib/syntax_tree/parser.rb b/lib/syntax_tree/parser.rb index d5b82507..92a58ccb 100644 --- a/lib/syntax_tree/parser.rb +++ b/lib/syntax_tree/parser.rb @@ -761,8 +761,14 @@ def on_break(arguments) # (:call | Backtick | Const | Ident | Op) message # ) -> Call def on_call(receiver, operator, message) - ending = message - ending = operator if message == :call + ending = + if message != :call + message + elsif operator != :"::" + operator + else + receiver + end Call.new( receiver: receiver, diff --git a/test/fixtures/call.rb b/test/fixtures/call.rb new file mode 100644 index 00000000..874d290c --- /dev/null +++ b/test/fixtures/call.rb @@ -0,0 +1,14 @@ +% +foo.bar +% +foo.() +% +foo::() +- +foo.() +% +foo.(1) +% +foo::(1) +- +foo.(1)