Class: CastOff::Compiler::SimpleIR::GlobalVariable
- Inherits:
-
Pointer
- Object
- TypeContainer
- Variable
- Pointer
- CastOff::Compiler::SimpleIR::GlobalVariable
- Defined in:
- lib/cast_off/compile/ir/operand.rb
Constant Summary
Constants inherited from TypeContainer
TypeContainer::FixnumWrapper, TypeContainer::FloatWrapper
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Attributes inherited from TypeContainer
Instance Method Summary collapse
- #==(v) ⇒ Object
- #eql?(v) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(gentry, types, translator) ⇒ GlobalVariable
constructor
A new instance of GlobalVariable.
- #source ⇒ Object
- #to_name ⇒ Object
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
Constructor Details
#initialize(gentry, types, translator) ⇒ GlobalVariable
Returns a new instance of GlobalVariable.
752 753 754 755 756 757 758 759 760 761 762 |
# File 'lib/cast_off/compile/ir/operand.rb', line 752 def initialize(gentry, types, translator) super() @id = gentry @name = gentry.slice(1, gentry.size - 1) @name = translator.allocate_name(@name) if types bug() unless types.is_a?(Array) is_annotated(types) end end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
750 751 752 |
# File 'lib/cast_off/compile/ir/operand.rb', line 750 def id @id end |
Instance Method Details
#==(v) ⇒ Object
777 778 779 |
# File 'lib/cast_off/compile/ir/operand.rb', line 777 def ==(v) eql?(v) end |
#eql?(v) ⇒ Boolean
772 773 774 775 |
# File 'lib/cast_off/compile/ir/operand.rb', line 772 def eql?(v) return false unless v.is_a?(GlobalVariable) @id == v.id end |
#hash ⇒ Object
781 782 783 |
# File 'lib/cast_off/compile/ir/operand.rb', line 781 def hash self.to_name.hash end |
#source ⇒ Object
768 769 770 |
# File 'lib/cast_off/compile/ir/operand.rb', line 768 def source @id.to_s end |
#to_name ⇒ Object
764 765 766 |
# File 'lib/cast_off/compile/ir/operand.rb', line 764 def to_name "global_#{@name}" end |