function now returns locals, not free registers
This commit is contained in:
@ -25,8 +25,7 @@ module Ast
|
||||
if( l_val ) #variable existed, move data there
|
||||
l_val = l_val.move( into , r_val)
|
||||
else
|
||||
next_register = context.function.next_register
|
||||
l_val = Vm::Integer.new(next_register).load( into , r_val )
|
||||
l_val = context.function.new_local.load( into , r_val )
|
||||
end
|
||||
context.locals[left.name] = l_val
|
||||
return l_val
|
||||
@ -38,12 +37,12 @@ module Ast
|
||||
when ">"
|
||||
code = l_val.less_or_equal into , r_val
|
||||
when "+"
|
||||
res = Vm::Integer.new(context.function.next_register)
|
||||
res = context.function.new_local
|
||||
into.add_code res.is l_val + r_val
|
||||
# code = res.plus into , l_val , r_val
|
||||
code = res
|
||||
when "-"
|
||||
res = Vm::Integer.new(context.function.next_register)
|
||||
res = context.function.new_local
|
||||
code = res.minus into , l_val , r_val
|
||||
else
|
||||
raise "unimplemented operator #{operator} #{self}"
|
||||
|
Reference in New Issue
Block a user