Class: YARP::ArgumentsNode

Inherits:
YARPNode
  • Object
show all
Defined in:
lib/yarp/node.rb,
ext/yarp/api_node.c

Overview

Represents a set of arguments to a method or a keyword.

return foo, bar, baz
       ^^^^^^^^^^^^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arguments, location) ⇒ ArgumentsNode

def initialize: (arguments: Array, location: Location) -> void



156
157
158
159
# File 'lib/yarp/node.rb', line 156

def initialize(arguments, location)
  @arguments = arguments
  @location = location
end

Instance Attribute Details

#argumentsObject (readonly)

attr_reader arguments: Array



153
154
155
# File 'lib/yarp/node.rb', line 153

def arguments
  @arguments
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



162
163
164
# File 'lib/yarp/node.rb', line 162

def accept(visitor)
  visitor.visit_arguments_node(self)
end

#child_nodesObject Also known as: deconstruct

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



167
168
169
# File 'lib/yarp/node.rb', line 167

def child_nodes
  [*arguments]
end

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]



175
176
177
# File 'lib/yarp/node.rb', line 175

def deconstruct_keys(keys)
  { arguments: arguments, location: location }
end