fix all tests

This commit is contained in:
Torsten Ruger
2014-07-15 00:00:00 +03:00
parent b59a9da34e
commit 9891da88a4
6 changed files with 23 additions and 9 deletions

View File

@ -74,7 +74,7 @@ module Ast
class VariableExpression < NameExpression
def compile frame ,method
Virtual::ObjectGet.new(name)
method.add Virtual::ObjectGet.new(name)
end
end
end

View File

@ -8,8 +8,8 @@ module Ast
frame = frame.new_frame
return_type = nil
body.each do |ex|
val = ex.compile(frame , method )
return_type = val.type
return_type = ex.compile(frame , method )
raise return_type.inspect if return_type.is_a? Virtual::Instruction
end
method.return_type = return_type
method

View File

@ -2,7 +2,11 @@ module Ast
class OperatorExpression < Expression
# attr_reader :operator, :left, :right
def compile frame , method
Virtual::Reference.new
tmp = method.get_tmp
ass = AssignmentExpression.new( tmp , left )
l = ass.compile(frame , method)
call = CallSiteExpression.new( operator , [right] , l)
call.compile(frame , method)
end
def scratch
into = context.function