diff --git a/lib/ruby.rb b/lib/ruby.rb index 12abf071..3055fec0 100644 --- a/lib/ruby.rb +++ b/lib/ruby.rb @@ -9,7 +9,7 @@ end require_relative "ruby/statement" require_relative "ruby/statements" -require_relative "ruby/assignment_statement" +require_relative "ruby/assignment" require_relative "ruby/array_statement" require_relative "ruby/block_statement" require_relative "ruby/if_statement" diff --git a/lib/ruby/assignment_statement.rb b/lib/ruby/assignment.rb similarity index 90% rename from lib/ruby/assignment_statement.rb rename to lib/ruby/assignment.rb index 066fe4a5..9b3304f9 100644 --- a/lib/ruby/assignment_statement.rb +++ b/lib/ruby/assignment.rb @@ -39,10 +39,6 @@ module Ruby class IvarAssignment < Assignment - def to_vool() - super() - return Vool::IvarAssignment.new(@name , @value) - end end class LocalAssignment < Assignment diff --git a/lib/vool/local_assignment.rb b/lib/vool/local_assignment.rb index b8f08db9..6533f7ed 100644 --- a/lib/vool/local_assignment.rb +++ b/lib/vool/local_assignment.rb @@ -8,6 +8,11 @@ module Vool from = @value.slot_definition(compiler) return chain_assign( Mom::SlotLoad.new(to,from) , compiler) end + + def chain_assign(assign , compiler) + return assign unless @value.is_a?(SendStatement) + @value.to_mom(compiler) << assign + end end end diff --git a/test/ruby/test_ivar_assignment.rb b/test/ruby/test_assignment.rb similarity index 100% rename from test/ruby/test_ivar_assignment.rb rename to test/ruby/test_assignment.rb diff --git a/test/ruby/test_local_assignment.rb b/test/ruby/test_assignment1.rb similarity index 100% rename from test/ruby/test_local_assignment.rb rename to test/ruby/test_assignment1.rb diff --git a/test/vool/test_local.rb b/test/vool/test_local_assignment.rb similarity index 100% rename from test/vool/test_local.rb rename to test/vool/test_local_assignment.rb