Class: CastOff::Compiler::SimpleIR::Self

Inherits:
Variable show all
Includes:
Util
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 included from Util

#bug, #dlog, #todo, #vlog

Methods inherited from Variable

#declare?, #has_undefined_path, #is_class_exact

Methods inherited from TypeContainer

#box, #boxed?, #boxed_form, #can_unbox?, #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, #static?, #to_s, #unboxed?, #undefined?, #union

Constructor Details

#initialize(translator, iseq) ⇒ Self

Returns a new instance of Self.



585
586
587
588
589
590
591
592
593
594
595
596
597
598
# File 'lib/cast_off/compile/ir/operand.rb', line 585

def initialize(translator, iseq)
  super()
  @iseq = iseq
  @translator = translator
  bug() unless @iseq.is_a?(Iseq)
  reciever_class = translator.reciever_class
  if reciever_class
    #is_static(reciever_class)
    reciever_class = [reciever_class] unless reciever_class.instance_of?(Array)
    reciever_class.each{|c| is_also(c)}
  else
    is_dynamic()
  end
end

Instance Attribute Details

#iseqObject (readonly)

Returns the value of attribute iseq.



583
584
585
# File 'lib/cast_off/compile/ir/operand.rb', line 583

def iseq
  @iseq
end

Instance Method Details

#==(v) ⇒ Object



619
620
621
# File 'lib/cast_off/compile/ir/operand.rb', line 619

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

#class_exact?Boolean

Returns:

  • (Boolean)


600
601
602
# File 'lib/cast_off/compile/ir/operand.rb', line 600

def class_exact?
  false
end

#eql?(v) ⇒ Boolean

Returns:

  • (Boolean)


612
613
614
615
616
617
# File 'lib/cast_off/compile/ir/operand.rb', line 612

def eql?(v)
  #v.is_a?(Self)
  return false unless v.is_a?(Self)
  return true if @translator.inline_block?
  @iseq == v.iseq
end

#hashObject



623
624
625
# File 'lib/cast_off/compile/ir/operand.rb', line 623

def hash
  self.to_name.hash
end

#resetObject



631
632
633
# File 'lib/cast_off/compile/ir/operand.rb', line 631

def reset()
  # nothing to do
end

#sourceObject



608
609
610
# File 'lib/cast_off/compile/ir/operand.rb', line 608

def source
  "self"
end

#to_debug_stringObject



627
628
629
# File 'lib/cast_off/compile/ir/operand.rb', line 627

def to_debug_string
  "#{super}(#{@iseq})"
end

#to_nameObject



604
605
606
# File 'lib/cast_off/compile/ir/operand.rb', line 604

def to_name
  "self"
end