fixed method_missing to check whether local var exists (not gobble everything up)

This commit is contained in:
Torsten Ruger 2014-05-21 12:44:36 +03:00
parent 53cfeb72a4
commit 16a07d5aa2

View File

@ -99,13 +99,17 @@ module Vm
# mov and add will be called on Machine and generate Inststuction that are then added
# to the block
def method_missing(meth, *args, &block)
if( meth.to_s[-1] == "=" && args.length == 1)
l_val = @scope.eval meth.to_s[0 ... -1]
add_code l_val.assign(args[0])
var = meth.to_s[0 ... -1]
if( args.length == 1) and ( meth.to_s[-1] == "=" )
if @scope.local_variable_defined? var.to_sym
l_val = @scope.local_variable_get var.to_sym
return add_code l_val.assign(args[0])
else
return super
end
end
add_code CMachine.instance.send(meth , *args)
end
end
end