diff --git a/lib/vool/compiler.rb b/lib/vool/compiler.rb index 21a1f20f..35bd1ae1 100644 --- a/lib/vool/compiler.rb +++ b/lib/vool/compiler.rb @@ -19,7 +19,7 @@ module Vool def on_def( statement ) name , args , body = *statement arg_array = process_all( args ) - MethodStatement.new( name , arg_array , body ) + MethodStatement.new( name , arg_array , process(body) ) end def on_arg( arg ) diff --git a/test/vool/test_method_statement.rb b/test/vool/test_method_statement.rb index 4a5ec6c8..392a558f 100644 --- a/test/vool/test_method_statement.rb +++ b/test/vool/test_method_statement.rb @@ -3,26 +3,28 @@ require_relative "helper" module Vool class TestMethodStatement < MiniTest::Test - def setup - input = "def tryout(arg1, arg2) ; end " + def basic_setup() + input = "def tryout(arg1, arg2) ; true ; false ; end " @lst = Compiler.compile( input ) end - - def test_compile_method + def test_method + basic_setup assert_equal MethodStatement , @lst.class end - def test_compile_method_name + def test_method_name + basic_setup assert_equal :tryout , @lst.name end - def test_compile_method_super + def test_method_args + basic_setup assert_equal [:arg1, :arg2] , @lst.args end - - def test_compile_method_body - assert_equal [] , @lst.body + def test_basic_body + basic_setup + assert_equal ScopeStatement , @lst.body.class + assert_equal 2 , @lst.body.length end - end end