ARefField
represents assigning values into collections at specific indices. Put another way, it’s any time you’re calling the method []=. The ARefField
node itself is just the left side of the assignment, and they’re always wrapped in assign nodes.
collection[index] = valueAttributes
Node
the value being indexed
Args
the value being passed within the brackets
def initialize(collection:, index:, location:) @collection = collection @index = index @location = location @comments = [] endPublic Instance Methods Source
def ===(other) other.is_a?(ARefField) && collection === other.collection && index === other.index endSource
def accept(visitor) visitor.visit_aref_field(self) endSource
def child_nodes [collection, index] endSource
def copy(collection: nil, index: nil, location: nil) node = ARefField.new( collection: collection || self.collection, index: index || self.index, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node endSource
def deconstruct_keys(_keys) { collection: collection, index: index, location: location, comments: comments } endSource
def format(q) q.group do q.format(collection) q.text("[") if index q.indent do q.breakable_empty q.format(index) end q.breakable_empty end q.text("]") end end
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4