From 3cdb3d513c59a5a1089d8718e774b0c37b68d67a Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Tue, 2 Jun 2015 09:05:27 +0300 Subject: [PATCH] move to basic types (not wrapped) --- lib/virtual/compiler/basic_expressions.rb | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/virtual/compiler/basic_expressions.rb b/lib/virtual/compiler/basic_expressions.rb index 90e3fb52..f1a0a1fe 100644 --- a/lib/virtual/compiler/basic_expressions.rb +++ b/lib/virtual/compiler/basic_expressions.rb @@ -13,30 +13,27 @@ module Virtual # attr_reader :value def self.compile_integer expression , method - int = IntegerConstant.new(expression.value) + int = expression.value to = Return.new(Integer , int) method.info.add_code Set.new( to , int) to end def self.compile_true expression , method - value = TrueConstant.new - to = Return.new(Reference , value) - method.info.add_code Set.new( to , value ) + to = Return.new(Reference , true ) + method.info.add_code Set.new( to , true ) to end def self.compile_false expression , method - value = FalseConstant.new - to = Return.new(Reference , value) - method.info.add_code Set.new( to , value ) + to = Return.new(Reference , false) + method.info.add_code Set.new( to , false ) to end def self.compile_nil expression , method - value = NilConstant.new - to = Return.new(Reference , value) - method.info.add_code Set.new( to , value ) + to = Return.new(Reference , nil) + method.info.add_code Set.new( to , nil ) to end @@ -85,7 +82,7 @@ module Virtual end r = Compiler.compile(expression.right , method ) 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 method.info.add_code Set.new(Return.new , MessageSlot.new(index , r,type , r )) else