starting on ruby send
This commit is contained in:
@ -27,6 +27,20 @@ module Melon
|
||||
w
|
||||
end
|
||||
|
||||
def on_send( statement )
|
||||
receiver , name , args = *statement
|
||||
w = Vm::Tree::CallSite.new()
|
||||
puts "receiver #{statement}"
|
||||
w.name = process(receiver)
|
||||
w.arguments = process(args)
|
||||
w.receiver = nil
|
||||
w
|
||||
end
|
||||
|
||||
def on_str( string )
|
||||
Vm::Tree::StringExpression.new(string.children.first)
|
||||
end
|
||||
|
||||
def on_int( expression)
|
||||
Vm::Tree::IntegerExpression.new(expression.children.first)
|
||||
end
|
||||
|
@ -40,7 +40,6 @@ module Melon
|
||||
def compile_methods(clazz , methods)
|
||||
methods.each do |method|
|
||||
typed_method = method.create_vm_method(clazz.instance_type)
|
||||
raise "NIL" unless method
|
||||
code = Compilers::MethodCompiler.new(method).get_code
|
||||
Vm::MethodCompiler.new( typed_method ).init_method.process( code)
|
||||
end
|
||||
|
@ -12,7 +12,7 @@ module Vm
|
||||
type = get_my_type(me)
|
||||
|
||||
method = type.get_method(statement.name)
|
||||
raise "Method not implemented #{type.inspect}.#{statement.name}" unless method
|
||||
raise "Method not implementedfor me#{type} #{type.inspect}.#{statement.name}" unless method
|
||||
|
||||
# move our receiver there
|
||||
add_reg_to_slot( statement , me , :new_message , :receiver)
|
||||
|
Reference in New Issue
Block a user