From cbff41b61d079f3e1ef85ede07d90d68ea0b5da6 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sun, 19 Jul 2015 11:15:38 +0300 Subject: [PATCH] test name expr --- lib/virtual/compiler/basic_expressions.rb | 2 +- test/compiler/compiler_helper.rb | 1 + test/fragments/helper.rb | 1 + test/fragments/test_functions.rb | 33 +++++++++++------------ test/fragments/test_if.rb | 10 +++---- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/lib/virtual/compiler/basic_expressions.rb b/lib/virtual/compiler/basic_expressions.rb index 375c8fa7..2481dc20 100644 --- a/lib/virtual/compiler/basic_expressions.rb +++ b/lib/virtual/compiler/basic_expressions.rb @@ -47,7 +47,7 @@ module Virtual if method.has_var(name) # either an argument, so it's stored in message if( index = method.has_arg(name)) - method.source.add_code MessageGet.new(expression.name , index) + method.source.add_code Set.new( MessageSlot.new(expression.name) , Return.new) else # or a local so it is in the frame method.source.add_code FrameGet.new(expression.name , index) end diff --git a/test/compiler/compiler_helper.rb b/test/compiler/compiler_helper.rb index 0fa9a965..89eedfc5 100644 --- a/test/compiler/compiler_helper.rb +++ b/test/compiler/compiler_helper.rb @@ -8,6 +8,7 @@ module CompilerHelper Virtual.machine.boot.compile_main @string_input produced = Virtual.machine.space.get_main.source assert_equal @output , produced + Virtual.machine.run_passes end end diff --git a/test/fragments/helper.rb b/test/fragments/helper.rb index 630688af..de715e8a 100644 --- a/test/fragments/helper.rb +++ b/test/fragments/helper.rb @@ -11,6 +11,7 @@ module Fragments @expect.each_with_index do | should , i | assert_equal should , expressions[i].class end +# Virtual.machine.run_passes end # helper to write the file diff --git a/test/fragments/test_functions.rb b/test/fragments/test_functions.rb index 59664980..c3e10b3e 100644 --- a/test/fragments/test_functions.rb +++ b/test/fragments/test_functions.rb @@ -7,20 +7,19 @@ class TestFunctions < MiniTest::Test @string_input = <