Class: CastOff::Compiler::SimpleIR::LocalVariable

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?, #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) ⇒ LocalVariable

Returns a new instance of LocalVariable.



870
871
872
873
874
875
876
877
878
879
880
881
# File 'lib/cast_off/compile/ir/operand.rb', line 870

def initialize(name, id, op_idx, lv, types)
  super()
  @name = name
  @id = id
  @op_idx = op_idx
  @level = lv

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

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



868
869
870
# File 'lib/cast_off/compile/ir/operand.rb', line 868

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



868
869
870
# File 'lib/cast_off/compile/ir/operand.rb', line 868

def name
  @name
end

Instance Method Details

#==(v) ⇒ Object



896
897
898
# File 'lib/cast_off/compile/ir/operand.rb', line 896

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

#eql?(v) ⇒ Boolean

Returns:

  • (Boolean)


891
892
893
894
# File 'lib/cast_off/compile/ir/operand.rb', line 891

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

#has_undefined_pathObject



904
905
906
# File 'lib/cast_off/compile/ir/operand.rb', line 904

def has_undefined_path()
  bug()
end

#hashObject



900
901
902
# File 'lib/cast_off/compile/ir/operand.rb', line 900

def hash
  self.to_name.hash
end

#sourceObject



887
888
889
# File 'lib/cast_off/compile/ir/operand.rb', line 887

def source
  @name.to_s
end

#to_nameObject



883
884
885
# File 'lib/cast_off/compile/ir/operand.rb', line 883

def to_name
  "local#{@id}_#{@name}"
end