plus function, indentation

This commit is contained in:
Torsten Ruger 2015-08-05 18:49:37 +03:00
parent 21b0702154
commit 8560f15c87
3 changed files with 92 additions and 94 deletions

View File

@ -8,7 +8,6 @@ module Register
plus_function.source.return_type = Virtual::Integer plus_function.source.return_type = Virtual::Integer
plus_function.source.receiver = Virtual::Integer plus_function.source.receiver = Virtual::Integer
plus_function.source.add_code Register::OperatorInstruction.new( plus_function, :add , 0 , 0 ) plus_function.source.add_code Register::OperatorInstruction.new( plus_function, :add , 0 , 0 )
return plus_function return plus_function
end end
# The conversion to base10 is quite a bit more complicated than i thought. # The conversion to base10 is quite a bit more complicated than i thought.

View File

@ -160,8 +160,6 @@ module Virtual
[:putint,:fibo , :plus].each do |f| [:putint,:fibo , :plus].each do |f|
obj.add_instance_method Register::Builtin::Integer.send(f , nil) obj.add_instance_method Register::Builtin::Integer.send(f , nil)
end end
# obj.alias :plus , :+
end end
end end
end end

View File

@ -32,9 +32,10 @@ module Virtual
raise "Method not implemented #{me.class}.#{code.name}" unless method raise "Method not implemented #{me.class}.#{code.name}" unless method
new_codes << MethodCall.new( method ) new_codes << MethodCall.new( method )
elsif( me.is_a? Fixnum ) elsif( me.is_a? Fixnum )
# get the function from my class. easy peasy name = code.name
method = Virtual.machine.space.get_class_by_name(:Integer).get_instance_method(code.name) name = :plus if name == :+
raise "Method not implemented #{me.class}.#{code.name}" unless method method = Virtual.machine.space.get_class_by_name(:Integer).get_instance_method(name)
raise "Method not implemented Integer.#{name}" unless method
new_codes << MethodCall.new( method ) new_codes << MethodCall.new( method )
else else
# note: this is the current view: call internal send, even the method name says else # note: this is the current view: call internal send, even the method name says else