Represents a method call, in all of the various forms that can take.

foo
^^^

foo()
^^^^^

+foo
^^^^

foo + bar
^^^^^^^^^

foo.bar
^^^^^^^

foo&.bar
^^^^^^^^
Attributes
Read

The object that the method is being called on. This can be either ‘nil` or any [non-void expression](github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).

foo.bar
^^^

+foo
 ^^^

foo + bar
^^^
Read

Represents the name of the method being called.

foo.bar # name `:foo`
^^^
Read

Represents the arguments to the method call. These can be any [non-void expressions](github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).

foo(bar)
    ^^^
Read

Represents the block that is being passed to the method.

foo { |a| a }
    ^^^^^^^^^
Class Methods

Initialize a new CallNode node.

Return a symbol representation of this node type. See ‘Node::type`.

Instance Methods

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.

def accept: (Visitor visitor) -> void

def attribute_write?: () -> bool

def call_operator: () -> String?

Represents the location of the call operator.

foo.bar
   ^

foo&.bar
   ^^

def child_nodes: () -> Array[nil | Node]

def closing: () -> String?

Represents the location of the right parenthesis.

foo(bar)
       ^

def comment_targets: () -> Array[Node | Location]

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?name: Symbol, ?message_loc: Location?, ?opening_loc: Location?, ?arguments: ArgumentsNode?, ?closing_loc: Location?, ?block: BlockNode | BlockArgumentNode | nil) -> CallNode

An alias for child_nodes

def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, receiver: Prism::node?, call_operator_loc: Location?, name: Symbol, message_loc: Location?, opening_loc: Location?, arguments: ArgumentsNode?, closing_loc: Location?, block: BlockNode | BlockArgumentNode | nil }

When a call node has the attribute_write flag set, it means that the call is using the attribute write syntax. This is either a method call to []= or a method call to a method that ends with =. Either way, the = sign is present in the source.

Prism returns the message_loc without the = sign attached, because there can be any amount of space between the message and the = sign. However, sometimes you want the location of the full message including the inner space and the = sign. This method provides that.

def ignore_visibility?: () -> bool

def inspect -> String

def message: () -> String?

Represents the location of the message.

foo.bar
    ^^^

def opening: () -> String?

Represents the location of the left parenthesis.

foo(bar)
   ^

def safe_navigation?: () -> bool

Save the call_operator_loc location using the given saved source so that it can be retrieved later.

Save the closing_loc location using the given saved source so that it can be retrieved later.

Save the message_loc location using the given saved source so that it can be retrieved later.

Save the opening_loc location using the given saved source so that it can be retrieved later.

Return a symbol representation of this node type. See ‘Node#type`.

def variable_call?: () -> bool