fix class function test

This commit is contained in:
Torsten Ruger 2014-07-14 17:08:52 +03:00
parent 93bdd8a243
commit 16a378e3da
3 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,8 @@ module Ast
frame = frame.new_frame frame = frame.new_frame
return_type = nil return_type = nil
body.each do |ex| body.each do |ex|
return_type = ex.compile(frame , method ) val = ex.compile(frame , method )
return_type = val.type
end end
method.return_type = return_type method.return_type = return_type
method method

View File

@ -18,6 +18,9 @@ module Virtual
def initialize nex = nil def initialize nex = nil
@next = nex @next = nex
end end
def type
Reference
end
end end
# the first instruction we need is to stop. Off course in a real machine this would be a syscall, but that is just # the first instruction we need is to stop. Off course in a real machine this would be a syscall, but that is just

View File

@ -19,7 +19,7 @@ def String.length(x)
@length @length
end end
HERE HERE
@output = [Virtual::Method.new(:length,[Ast::NameExpression.new(:x)],Boot::BootClass.new(:String,:Object))] @output = [Virtual::Method.new(:length,[Ast::NameExpression.new(:x)],Boot::BootClass.new(:String,:Object),Virtual::Reference,Virtual::MethodEnter.new(Virtual::FrameSend.new(:_get_instance_variable , [ Virtual::StringConstant.new('length')])))]
check check
end end