fix all tests
This commit is contained in:
@ -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
|
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user