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:
Torsten Ruger
2018-08-14 19:39:46 +03:00
parent 0bf008b351
commit 37461a1727
9 changed files with 68 additions and 60 deletions

View File

@ -37,20 +37,20 @@ module Mom
cache_entry_ = @cache_entry
builder = compiler.code_builder(self)
builder.build do
word << name_
cache_entry << cache_entry_
word! << name_
cache_entry! << cache_entry_
type << cache_entry[:cached_type]
callable_method << type[:methods]
type! << cache_entry[:cached_type]
callable_method! << type[:methods]
add_code while_start_label
space << Parfait.object_space
space! << Parfait.object_space
space << space[:nil_object]
space - callable_method
if_zero exit_label
name << callable_method[:name]
name! << callable_method[:name]
name - word
if_zero ok_label