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:
@ -36,16 +36,16 @@ module Mom
|
||||
def build_with(builder)
|
||||
case from = method_source
|
||||
when Parfait::CallableMethod
|
||||
builder.build { callable << from }
|
||||
builder.build { callable! << from }
|
||||
when Parfait::CacheEntry
|
||||
builder.build do
|
||||
cache_entry << from
|
||||
callable << cache_entry[:cached_method]
|
||||
cache_entry! << from
|
||||
callable! << cache_entry[:cached_method]
|
||||
end
|
||||
when Integer
|
||||
builder.build do
|
||||
arguments << message[:arguments]
|
||||
callable << arguments[ from ]
|
||||
arguments! << message[:arguments]
|
||||
callable! << arguments[ from ]
|
||||
end
|
||||
else
|
||||
raise "unknown source #{method_source.class}:#{method_source}"
|
||||
@ -64,11 +64,11 @@ module Mom
|
||||
# set the method into the message
|
||||
def build_message_data( builder )
|
||||
builder.build do
|
||||
space << Parfait.object_space
|
||||
next_message << space[:next_message]
|
||||
space! << Parfait.object_space
|
||||
next_message! << space[:next_message]
|
||||
|
||||
#FIXME in a multithreaded future this should be done using lock free compare and swap.
|
||||
next_message_reg << next_message[:next_message]
|
||||
next_message_reg! << next_message[:next_message]
|
||||
space[:next_message] << next_message_reg
|
||||
|
||||
message[:next_message] << next_message
|
||||
|
@ -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
|
||||
|
@ -23,17 +23,17 @@ module Mom
|
||||
compiler.reset_regs
|
||||
builder = compiler.code_builder(self)
|
||||
builder.build do
|
||||
object << message[:return_value]
|
||||
caller_reg << message[:caller]
|
||||
object! << message[:return_value]
|
||||
caller_reg! << message[:caller]
|
||||
caller_reg[:return_value] << object
|
||||
space << Parfait.object_space
|
||||
next_message << space[:next_message]
|
||||
space! << Parfait.object_space
|
||||
next_message! << space[:next_message]
|
||||
message[:next_message] << next_message
|
||||
space[:next_message] << message
|
||||
end
|
||||
compiler.reset_regs
|
||||
builder.build do
|
||||
return_address << message[:return_address]
|
||||
return_address! << message[:return_address]
|
||||
return_address << return_address[ Parfait::Integer.integer_index]
|
||||
message << message[:caller]
|
||||
return_address.function_return
|
||||
|
Reference in New Issue
Block a user