add the ! syntax to create variables in builder, fix #8
now a variable has to be created before being used thus it is save to develop contracts where a certain name must exist in the scope Maybe the syntax starts getting a bit weird, but at least the ! is a common symbol in ruby
This commit is contained in:
@ -12,17 +12,17 @@ module Risc
|
||||
end
|
||||
def test_inserts_built
|
||||
r1 = RegisterValue.new(:r1 , :Space)
|
||||
@builder.build{ space << r1 }
|
||||
@builder.build{ space! << r1 }
|
||||
assert_equal Transfer , @compiler.risc_instructions.next.class
|
||||
assert_equal RegisterValue , @builder.space.class
|
||||
end
|
||||
def test_loads
|
||||
@builder.build{ space << Parfait.object_space }
|
||||
@builder.build{ space! << Parfait.object_space }
|
||||
assert_equal LoadConstant , @compiler.risc_instructions.next.class
|
||||
assert_equal RegisterValue , @builder.space.class
|
||||
end
|
||||
def test_two
|
||||
@builder.build{ space << Parfait.object_space ; integer << 1}
|
||||
@builder.build{ space! << Parfait.object_space ; integer! << 1}
|
||||
assert_equal LoadConstant , @compiler.risc_instructions.next.class
|
||||
assert_equal LoadData , @compiler.risc_instructions.next(2).class
|
||||
end
|
||||
|
Reference in New Issue
Block a user