ruby-syntax-tree / syntax_tree

Interact with the Ruby syntax tree

Home Page:https://ruby-syntax-tree.github.io/syntax_tree/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Combine ARef, ARefField, CallNode, Command, CommandCall, Field, Not, Unary, and VCall into CallNode

kddnewton opened this issue · comments

All of these various nodes represent method calls. They should all be part of the same node. It is very confusing to have to manually look for every kind of node in every visitor.

YARP has:

  • receiver (the receiver of the call, optional)
  • operator (the operator used, ., &., or ::)
  • message (the message being sent)
  • opening_loc (the optional left parenthesis or bracket)
  • arguments (the arguments node)
  • closing_loc (the optional right parenthesis or bracket)
  • block (the optional block)
  • name (the synthesized name of the call)

In most cases name will match message but if you have something like foo.bar = 1 then message will be bar and name will be "bar=". In foo.() message will be nil but name will be "call".