first propper hoisting test

had to change course, normalising and object creation is not possible
in one go
have to now generate random tmp vars  that will have to be picked up
later (sorted by tmp_ prefix?)
This commit is contained in:
Torsten Ruger
2018-03-15 12:46:56 +05:30
parent 9ddcb3224c
commit 3702411043
13 changed files with 149 additions and 54 deletions

View File

@ -30,9 +30,8 @@ module Vool
include CompilerHelper
def test_compile_one_method
lst = RubyCompiler.compile( in_Test("@ivar") )
assert_equal ScopeStatement , lst.body.class
assert_equal InstanceVariable , lst.body.statements.first.class
lst = RubyCompiler.compile( in_Test("@ivar = 4") )
assert_equal IvarAssignment , lst.body.class
end
def test_compile_two_methods
lst = RubyCompiler.compile( in_Test("false; true;") )

View File

@ -27,9 +27,9 @@ module Vool
assert_equal 2 , @lst.body.length
end
def test_body_is_scope_one_statement
input = "def tryout(arg1, arg2) ; true ; end "
input = "def tryout(arg1, arg2) ; a = true ; end "
lst = RubyCompiler.compile( input )
assert_equal ScopeStatement , lst.body.class
assert_equal LocalAssignment , lst.body.class
end
def test_body_is_scope_zero_statement
input = "def tryout(arg1, arg2) ; ; end "