modulize operator_expression

This commit is contained in:
Torsten Ruger
2016-12-09 14:17:01 +02:00
parent 037fd722df
commit 99132a92b6
4 changed files with 9 additions and 10 deletions

View File

@@ -1,16 +1,13 @@
module Typed
Compiler.class_eval do
module OperatorExpression
def on_OperatorExpression statement
#puts "operator #{statement.inspect}"
# operator , left_e , right_e = *statement
# operator , left_e , right_e = *statement
# left and right must be expressions. Expressions return a register when compiled
left_reg = process(statement.left_expression)
right_reg = process(statement.right_expression)
raise "Not register #{left_reg}" unless left_reg.is_a?(Register::RegisterValue)
raise "Not register #{right_reg}" unless right_reg.is_a?(Register::RegisterValue)
#puts "left #{left_reg}"
#puts "right #{right_reg}"
add_code Register::OperatorInstruction.new(statement,statement.operator,left_reg,right_reg)
return left_reg # though this has wrong value attached
end