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



159
160
161
162
# File 'lib/yarp/node.rb', line 159

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

Instance Attribute Details

#argumentsObject (readonly)

attr_reader arguments: Array



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

def arguments
  @arguments
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



165
166
167
# File 'lib/yarp/node.rb', line 165

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

#child_nodesObject Also known as: deconstruct

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



171
172
173
# File 'lib/yarp/node.rb', line 171

def child_nodes
  [*arguments]
end

#deconstruct_keys(keys) ⇒ Object

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



179
180
181
# File 'lib/yarp/node.rb', line 179

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