class Ikra::Translator::ArrayCommandStructBuilder::RequireRuntimeSizeChecker

This class determines if a `size` instance method should be generated for an array_command struct type. This is the case iff struct, or its first input, or the first input of its first input, etc., is an ArrayInHostSectionCommand. The size of such arrays is in general not known at compile time.

Public Class Methods

require_size_function?(command) click to toggle source
# File lib/translator/array_command_struct_builder.rb, line 50
def self.require_size_function?(command)
    return command.accept(self.new)
end

Public Instance Methods

visit_array_command(command) click to toggle source
# File lib/translator/array_command_struct_builder.rb, line 74
def visit_array_command(command)
    if command.input.size == 0
        return false
    else
        return command.input.first.command.accept(self)
    end
end
visit_array_identity_command(command) click to toggle source
# File lib/translator/array_command_struct_builder.rb, line 59
def visit_array_identity_command(command)
    # Fully fused, size known at compile time
    return false
end
visit_array_in_host_section_command(command) click to toggle source
# File lib/translator/array_command_struct_builder.rb, line 64
def visit_array_in_host_section_command(command)
    # Cannot be fused, size unknown at compile time
    return true
end
visit_array_reduce_command(command) click to toggle source
# File lib/translator/array_command_struct_builder.rb, line 54
def visit_array_reduce_command(command)
    # Size is always 1
    return false
end
visit_fixed_size_array_in_host_section_command(command) click to toggle source
# File lib/translator/array_command_struct_builder.rb, line 69
def visit_fixed_size_array_in_host_section_command(command)
    # Size is part of the type/command
    return false
end