fix locals scope in method and blocks

methods used to gobble up any locals of included scope. fixed
Blocks now create frame_type correctly and don't include and locals that are in fact method scope
This commit is contained in:
Torsten Ruger
2018-07-09 17:55:45 +03:00
parent 4ac89ece66
commit 06e78a7326
4 changed files with 24 additions and 7 deletions

View File

@ -7,7 +7,7 @@ module Vool
def setup
Parfait.boot!
@ret = compile_mom( as_test_main("self.main {|elem| elem } "))
@ret = compile_mom( as_test_main("self.main {|elem| elem = 5 } "))
end
def test_is_compiler
assert_equal Mom::MomCompiler , @ret.class
@ -39,4 +39,15 @@ module Vool
assert_equal 1, @block.frame_type.variable_index(:local)
end
end
class TestBlockMethod < MiniTest::Test
include MomCompile
def setup
Parfait.boot!
@ret = compile_mom( as_test_main("arg.each {|elem| arg = 5 } "))
@block = @ret.method_compilers.first.method.blocks
end
def test_block_arg_type
assert_equal Parfait::Type, @block.arguments_type.class
end
end
end