finish the idea behind #8, conditionally creating variables

by using space? , the ? makes for conditional creation of the variable
This is especially useful for constants (ie space)
This commit is contained in:
Torsten Ruger
2018-08-15 19:59:17 +03:00
parent 01752aab05
commit 1dabe0fda1
3 changed files with 23 additions and 13 deletions

View File

@ -25,6 +25,17 @@ module Risc
def test_caller_reg
assert_equal :Message , @builder.infer_type(:caller_reg).class_name
end
def test_define_twice
@builder.caller_reg!
assert_raises{ @builder.caller_reg! }
end
def test_define_conditionally_first
assert_equal :r1 , @builder.caller_reg?.symbol
end
def test_define_conditionally_again
first = @builder.caller_reg!
assert_equal first , @builder.caller_reg?
end
def test_caller_tmp
assert_equal :Message , @builder.infer_type(:caller_tmp).class_name
end