Class: CastOff::Compiler::SimpleIR::Argument

Inherits:
Variable show all
Defined in:
lib/cast_off/compile/ir/operand.rb

Constant Summary

Constants inherited from TypeContainer

TypeContainer::FixnumWrapper, TypeContainer::FloatWrapper

Instance Attribute Summary collapse

Attributes inherited from TypeContainer

#state, #types

Instance Method Summary collapse

Methods inherited from Variable

#class_exact?, #declare?, #has_undefined_path, #is_class_exact, #reset

Methods inherited from TypeContainer

#box, #boxed?, #boxed_form, #can_unbox?, #class_exact?, #declare, #declare_class, #dynamic?, #is_also, #is_also?, #is_annotated, #is_class_exact, #is_dynamic, #is_just?, #is_negative_cond_value, #is_not, #is_static, #not_initialized, #reset, #static?, #to_debug_string, #to_s, #unboxed?, #undefined?, #union

Methods included from Util

#bug, #dlog, #todo, #vlog

Constructor Details

#initialize(name, id, op_idx, lv, types) ⇒ Argument

Returns a new instance of Argument.



831
832
833
834
835
836
837
838
839
840
841
842
843
# File 'lib/cast_off/compile/ir/operand.rb', line 831

def initialize(name, id, op_idx, lv, types)
  super()
  @name = name
  @id = id
  @op_idx = op_idx
  @level = lv
  @lvar = "local#{@id}_#{@name}" # FIXME

  if types
    bug() unless types.is_a?(Array)
    is_static(types)
  end
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



829
830
831
# File 'lib/cast_off/compile/ir/operand.rb', line 829

def id
  @id
end

#lvarObject (readonly)

Returns the value of attribute lvar.



829
830
831
# File 'lib/cast_off/compile/ir/operand.rb', line 829

def lvar
  @lvar
end

Instance Method Details

#==(v) ⇒ Object



858
859
860
# File 'lib/cast_off/compile/ir/operand.rb', line 858

def ==(v)
  eql?(v)
end

#eql?(v) ⇒ Boolean

Returns:

  • (Boolean)


853
854
855
856
# File 'lib/cast_off/compile/ir/operand.rb', line 853

def eql?(v)
  return false unless v.is_a?(Argument)
  @id == v.id
end

#hashObject



862
863
864
# File 'lib/cast_off/compile/ir/operand.rb', line 862

def hash
  self.to_name.hash
end

#sourceObject



849
850
851
# File 'lib/cast_off/compile/ir/operand.rb', line 849

def source
  bug()
end

#to_nameObject



845
846
847
# File 'lib/cast_off/compile/ir/operand.rb', line 845

def to_name
  "<Argument:#{@id}_#{@name}>"
end