adds self reference and improve methods a little
This commit is contained in:
@ -34,6 +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
|
||||
if method.has_var(name)
|
||||
frame.compile_get(method , name )
|
||||
else
|
||||
|
@ -5,6 +5,13 @@ module Ast
|
||||
args = params.collect{ |p| p.compile(frame , method )}
|
||||
r = receiver ? receiver.compile(frame,method) : Virtual::SelfReference.new
|
||||
method = Virtual::Method.new(name , params , r )
|
||||
frame = frame.new_frame
|
||||
return_type = nil
|
||||
body.each do |ex|
|
||||
return_type = ex.compile(frame , method )
|
||||
end
|
||||
method.return_type = return_type
|
||||
method
|
||||
end
|
||||
def scratch
|
||||
args = []
|
||||
|
Reference in New Issue
Block a user