add scope and kwbegin

scope is just a list of statements
This commit is contained in:
Torsten Ruger
2017-04-02 13:24:09 +03:00
parent 27e4e9f501
commit 539ab692a3
7 changed files with 50 additions and 3 deletions

View File

@ -5,7 +5,7 @@ module Vool
def test_self
lst = Compiler.compile( "self")
assert_equal SelfStatement , lst.class
assert_equal SelfStatement , lst.class
end
def test_nil
lst = Compiler.compile( "nil")
@ -36,5 +36,14 @@ module Vool
Compiler.compile( '"dstr#{self}"')
end
end
def test_scope
lst = Compiler.compile( "begin ; 1 ; end")
assert_equal ScopeStatement , lst.class , lst.inspect
end
def test_scope_contents
lst = Compiler.compile( "begin ; 1 ; end")
assert_equal 1 , lst.statements.first.value
end
end
end

View File

@ -36,6 +36,5 @@ module Vool
lst = Compiler.compile( "bar(1)")
assert_equal 1 , lst.arguments.first.value
end
end
end

View File

@ -0,0 +1,14 @@
require_relative "../helper"
module Vool
class TestVariables < MiniTest::Test
# "free standing" local can not be tested as it will result in send
# in other words ther is no way of knowing if a name is variable or method
def ptest_send_to_local
lst = Compiler.compile( "foo = 1 ; foo.bar")
assert_equal LocalVariable , lst.receiver
end
end
end