Module: YTLJit::VM::Node::SendSingletonClassUtil

Included in:
SendAllocateNode, SendDirnameNode, SendOpenNode
Defined in:
lib/ytljit/vm.rb

Instance Method Summary collapse

Instance Method Details

#get_singleton_class_object(slfnode) ⇒ Object



1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
# File 'lib/ytljit/vm.rb', line 1013

def get_singleton_class_object(slfnode)
  tt = nil
  case slfnode
  when ConstantRefNode
    clstop = slfnode.value_node
    case clstop
    when ClassTopNode
      tt = RubyType::BaseType.from_ruby_class(clstop.klass_object)
    when LiteralNode
      tt = RubyType::BaseType.from_ruby_class(clstop.value)
    else
      raise "Unkown node type in constant #{slfnode.value_node.class}"
    end
    
  else
    raise "Unkonwn node type #{@arguments[2].class} "
  end

  tt
end