class Ikra::AST::SendNode

Attributes

arguments[R]
block_argument[R]
receiver[R]
return_type_by_recv_type[W]
selector[R]

Public Class Methods

new(receiver:, selector:, arguments: [], block_argument: nil) click to toggle source
# File lib/ast/nodes.rb, line 642
def initialize(receiver:, selector:, arguments: [], block_argument: nil)
    @receiver = receiver
    @selector = selector
    @arguments = arguments
    @block_argument = block_argument

    receiver.parent = self
    arguments.each do |arg|
        arg.parent = self
    end
end

Public Instance Methods

accept(visitor) click to toggle source
# File lib/ast/visitor.rb, line 182
def accept(visitor)
    return visitor.visit_send_node(self)
end
block_argument=(value) click to toggle source

Setter required for [HostSectionBuilder]

# File lib/ast/nodes.rb, line 679
def block_argument=(value)
    @block_argument = value
end
clone() click to toggle source
# File lib/ast/nodes.rb, line 654
def clone
    return SendNode.new(
        receiver: @receiver.clone,
        selector: @selector,
        arguments: @arguments.map do |a| a.clone end,
        block_argument: block_argument == nil ? nil : block_argument.clone)
end
replace_child(node, another_node) click to toggle source
# File lib/ast/nodes.rb, line 662
def replace_child(node, another_node)
    if @receiver.equal?(node)
        @receiver = another_node
        another_node.parent = self
    end

    @arguments = @arguments.map do |arg|
        if node.equal?(arg)
            another_node.parent = self
            another_node
        else
            arg
        end
    end
end
return_type_by_recv_type() click to toggle source

Mapping: Receiver type –> Return value of send

# File lib/types/inference/ast_inference.rb, line 138
def return_type_by_recv_type
    @return_type_by_recv_type ||= {}
end
to_s() click to toggle source
# File lib/ast/printer.rb, line 182
def to_s
    args = arguments.map do |arg|
        arg.to_s
    end.join("; ")

    return "[SendNode: #{receiver.to_s}.#{selector.to_s}(#{args})]"
end