more symbol related fixes

This commit is contained in:
Torsten Ruger
2015-06-01 17:31:35 +03:00
parent 5726d2c181
commit aea8f20be5
5 changed files with 22 additions and 20 deletions

View File

@ -37,7 +37,7 @@ module Parfait
# used to determine if a send must be issued
# return index of the name into the message if so
def has_var name
raise "uups #{name}.#{name.class}" unless name.is_a? Word
raise "uups #{name}.#{name.class}" unless name.is_a? Symbol
index = has_arg(name)
return index if index
has_local(name)
@ -45,22 +45,22 @@ module Parfait
# determine whether this method has an argument by the name
def has_arg name
raise "uups #{name}.#{name.class}" unless name.is_a? Word
raise "uups #{name}.#{name.class}" unless name.is_a? Symbol
@arg_names.index_of name
end
# determine if method has a local variable or tmp (anonymous local) by given name
def has_local name
raise "uups #{name}.#{name.class}" unless name.is_a? Word
index = @locals.index(name)
index = @tmps.index(name) unless index
raise "uups #{name}.#{name.class}" unless name.is_a? Symbol
index = @locals.index_of(name)
index = @tmps.index_of(name) unless index
index
end
def ensure_local name
index = has_local name
return index if index
@locals << name
@locals.push name
@locals.length
end