CommandCall
represents a method call on an object with arguments and no parentheses.
object.method argumentAttributes
Args
| ArgParen
the arguments going along with the message
BlockNode
the block associated with this method call
Op
| Period
the operator used to send the message
Node
the receiver of the message
def initialize( receiver:, operator:, message:, arguments:, block:, location: ) @receiver = receiver @operator = operator @message = message @arguments = arguments @block = block @location = location @comments = [] endPublic Instance Methods Source
def ===(other) other.is_a?(CommandCall) && receiver === other.receiver && operator === other.operator && message === other.message && arguments === other.arguments && block === other.block endSource
def accept(visitor) visitor.visit_command_call(self) endSource
def arity arguments&.arity || 0 endSource
def child_nodes [receiver, message, arguments, block] endSource
def copy( receiver: nil, operator: nil, message: nil, arguments: nil, block: nil, location: nil ) node = CommandCall.new( receiver: receiver || self.receiver, operator: operator || self.operator, message: message || self.message, arguments: arguments || self.arguments, block: block || self.block, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node endSource
def deconstruct_keys(_keys) { receiver: receiver, operator: operator, message: message, arguments: arguments, block: block, location: location, comments: comments } endSource
def format(q) message = self.message arguments = self.arguments block = self.block q.group do doc = q.nest(0) do q.format(receiver) if message != :call && message.comments.any?(&:leading?) q.format(CallOperatorFormatter.new(operator), stackable: false) q.indent do q.breakable_empty q.format(message) end else q.format(CallOperatorFormatter.new(operator), stackable: false) q.format(message) end end if arguments parts = arguments.parts if parts.length == 1 && parts.first.is_a?(IfOp) q.if_flat { q.text(" ") } q.format(arguments) else q.text(" ") q.nest(argument_alignment(q, doc)) { q.format(arguments) } end end end q.format(block) if block 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