From 3a152c1295c3bb982510f53164b551975b91004c Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Tue, 15 Jul 2014 18:34:03 +0300 Subject: [PATCH] adds self to sends args --- lib/ast/basic_expressions.rb | 2 +- lib/ast/call_site_expression.rb | 3 +-- lib/virtual/frame.rb | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ast/basic_expressions.rb b/lib/ast/basic_expressions.rb index fc78ad37..626dc4da 100644 --- a/lib/ast/basic_expressions.rb +++ b/lib/ast/basic_expressions.rb @@ -38,7 +38,7 @@ module Ast if method.has_var(name) frame.compile_get(method , name ) else - frame.compile_send( method , name ) + frame.compile_send( method , name , Virtual::Self.new( Virtual::Mystery.new ) ) end end end diff --git a/lib/ast/call_site_expression.rb b/lib/ast/call_site_expression.rb index c33179e7..a24a3bcb 100644 --- a/lib/ast/call_site_expression.rb +++ b/lib/ast/call_site_expression.rb @@ -6,9 +6,8 @@ module Ast @@counter = 0 def compile frame , method me = receiver.compile(frame , method ) - method.add Virtual::LoadSelf.new(me) with = args.collect{|a| a.compile(frame , method)} - frame.compile_send( method , name , with ) + frame.compile_send( method , name , me , with ) end def scratch diff --git a/lib/virtual/frame.rb b/lib/virtual/frame.rb index a3248065..46191e39 100644 --- a/lib/virtual/frame.rb +++ b/lib/virtual/frame.rb @@ -33,7 +33,8 @@ module Virtual method.get_var(name) end - def compile_send method , name , with = [] + def compile_send method , name , me , with = [] + method.add Virtual::LoadSelf.new(me) method.add FrameSend.new(name , with ) Return.new( method.return_type ) end