fixes the tests after fixing hierarchy

This commit is contained in:
Torsten Ruger
2014-07-15 10:35:29 +03:00
parent 49f73c090d
commit 930740e1db
11 changed files with 79 additions and 25 deletions

View File

@ -34,7 +34,7 @@ module Ast
# otherwise it's a method without args and a send is ussued.
# this makes the namespace static, ie when eval and co are implemented method needs recompilation
def compile frame , method
return Virtual::SelfReference.new() if name == :self
return Virtual::Self.new( Virtual::Mystery.new ) if name == :self
if method.has_var(name)
frame.compile_get(method , name )
else
@ -75,6 +75,7 @@ module Ast
class VariableExpression < NameExpression
def compile frame ,method
method.add Virtual::ObjectGet.new(name)
Virtual::Return.new( Virtual::Mystery.new )
end
end
end

View File

@ -6,7 +6,7 @@ module Ast
@@counter = 0
def compile frame , method
with = args.collect{|a| a.compile(frame , method)}
frame.compile_send( method , @name , with )
frame.compile_send( method , name , with )
end
def scratch

View File

@ -2,12 +2,10 @@ module Ast
class OperatorExpression < Expression
# attr_reader :operator, :left, :right
def compile frame , method
tmp = method.get_tmp
ass = AssignmentExpression.new( tmp , left )
l = ass.compile(frame , method)
call = CallSiteExpression.new( operator , [right] , l)
call = CallSiteExpression.new( operator , [right] , left )
call.compile(frame , method)
end
def scratch
into = context.function
puts "compiling operator #{to_s}"