move to basic types (not wrapped)

This commit is contained in:
Torsten Ruger 2015-06-02 09:05:27 +03:00
parent aea8f20be5
commit 3cdb3d513c

View File

@ -13,30 +13,27 @@ module Virtual
# attr_reader :value # attr_reader :value
def self.compile_integer expression , method def self.compile_integer expression , method
int = IntegerConstant.new(expression.value) int = expression.value
to = Return.new(Integer , int) to = Return.new(Integer , int)
method.info.add_code Set.new( to , int) method.info.add_code Set.new( to , int)
to to
end end
def self.compile_true expression , method def self.compile_true expression , method
value = TrueConstant.new to = Return.new(Reference , true )
to = Return.new(Reference , value) method.info.add_code Set.new( to , true )
method.info.add_code Set.new( to , value )
to to
end end
def self.compile_false expression , method def self.compile_false expression , method
value = FalseConstant.new to = Return.new(Reference , false)
to = Return.new(Reference , value) method.info.add_code Set.new( to , false )
method.info.add_code Set.new( to , value )
to to
end end
def self.compile_nil expression , method def self.compile_nil expression , method
value = NilConstant.new to = Return.new(Reference , nil)
to = Return.new(Reference , value) method.info.add_code Set.new( to , nil )
method.info.add_code Set.new( to , value )
to to
end end
@ -85,7 +82,7 @@ module Virtual
end end
r = Compiler.compile(expression.right , method ) r = Compiler.compile(expression.right , method )
raise "oh noo, nil from where #{expression.right.inspect}" unless r raise "oh noo, nil from where #{expression.right.inspect}" unless r
index = method.has_arg(name) index = method.has_arg(expression.left.name.to_sym)
if index if index
method.info.add_code Set.new(Return.new , MessageSlot.new(index , r,type , r )) method.info.add_code Set.new(Return.new , MessageSlot.new(index , r,type , r ))
else else