more symbol related fixes
This commit is contained in:
parent
5726d2c181
commit
aea8f20be5
@ -37,7 +37,7 @@ module Parfait
|
|||||||
# used to determine if a send must be issued
|
# used to determine if a send must be issued
|
||||||
# return index of the name into the message if so
|
# return index of the name into the message if so
|
||||||
def has_var name
|
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)
|
index = has_arg(name)
|
||||||
return index if index
|
return index if index
|
||||||
has_local(name)
|
has_local(name)
|
||||||
@ -45,22 +45,22 @@ module Parfait
|
|||||||
|
|
||||||
# determine whether this method has an argument by the name
|
# determine whether this method has an argument by the name
|
||||||
def has_arg 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
|
@arg_names.index_of name
|
||||||
end
|
end
|
||||||
|
|
||||||
# determine if method has a local variable or tmp (anonymous local) by given name
|
# determine if method has a local variable or tmp (anonymous local) by given name
|
||||||
def has_local name
|
def has_local name
|
||||||
raise "uups #{name}.#{name.class}" unless name.is_a? Word
|
raise "uups #{name}.#{name.class}" unless name.is_a? Symbol
|
||||||
index = @locals.index(name)
|
index = @locals.index_of(name)
|
||||||
index = @tmps.index(name) unless index
|
index = @tmps.index_of(name) unless index
|
||||||
index
|
index
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensure_local name
|
def ensure_local name
|
||||||
index = has_local name
|
index = has_local name
|
||||||
return index if index
|
return index if index
|
||||||
@locals << name
|
@locals.push name
|
||||||
@locals.length
|
@locals.length
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ module Virtual
|
|||||||
# compile code then works with the method, but adds code tot the info
|
# compile code then works with the method, but adds code tot the info
|
||||||
def self.create_method( class_name , method_name , args)
|
def self.create_method( class_name , method_name , args)
|
||||||
raise "uups #{class_name}.#{class_name.class}" unless class_name.is_a? Symbol
|
raise "uups #{class_name}.#{class_name.class}" unless class_name.is_a? Symbol
|
||||||
raise "uups #{method_name}.#{method_name.class}" unless class_name.is_a? Symbol
|
raise "uups #{method_name}.#{method_name.class}" unless method_name.is_a? Symbol
|
||||||
clazz = Virtual.machine.space.get_class_by_name class_name
|
clazz = Virtual.machine.space.get_class_by_name class_name
|
||||||
raise "No such class #{class_name}" unless clazz
|
raise "No such class #{class_name}" unless clazz
|
||||||
method = clazz.create_instance_method( method_name , Virtual.new_list(args))
|
method = clazz.create_instance_method( method_name , Virtual.new_list(args))
|
||||||
|
@ -18,10 +18,10 @@ module Virtual
|
|||||||
r = Self.new()
|
r = Self.new()
|
||||||
class_name = method.for_class.name
|
class_name = method.for_class.name
|
||||||
end
|
end
|
||||||
new_method = CompiledMethodInfo.create_method(class_name, expression.name.to_s , args )
|
new_method = CompiledMethodInfo.create_method(class_name, expression.name , args )
|
||||||
new_method.info.receiver = r
|
new_method.info.receiver = r
|
||||||
new_method.for_class.add_instance_method new_method
|
new_method.for_class.add_instance_method new_method
|
||||||
|
|
||||||
#frame = frame.new_frame
|
#frame = frame.new_frame
|
||||||
return_type = nil
|
return_type = nil
|
||||||
expression.body.each do |ex|
|
expression.body.each do |ex|
|
||||||
|
@ -30,6 +30,18 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'test'))
|
|||||||
|
|
||||||
require 'salama'
|
require 'salama'
|
||||||
|
|
||||||
|
module Virtual
|
||||||
|
# Functions to generate parfait objects
|
||||||
|
def self.new_word( string )
|
||||||
|
string = string.to_s if string.is_a? Symbol
|
||||||
|
word = Parfait::Word.new_object( string.length )
|
||||||
|
string.codepoints.each_with_index do |code , index |
|
||||||
|
word.set_char(index + 1 , code)
|
||||||
|
end
|
||||||
|
word
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class Ignored
|
class Ignored
|
||||||
def == other
|
def == other
|
||||||
return false unless other.class == self.class
|
return false unless other.class == self.class
|
||||||
|
@ -28,17 +28,7 @@ module VirtualHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
module Virtual
|
|
||||||
# Functions to generate parfait objects
|
|
||||||
def self.new_word( string )
|
|
||||||
string = string.to_s if string.is_a? Symbol
|
|
||||||
word = Parfait::Word.new_object( string.length )
|
|
||||||
string.codepoints.each_with_index do |code , index |
|
|
||||||
word.set_char(index + 1 , code)
|
|
||||||
end
|
|
||||||
word
|
|
||||||
end
|
|
||||||
end
|
|
||||||
class UnusedSofEquality
|
class UnusedSofEquality
|
||||||
# simple thought: don't recurse for Blocks, just check their names
|
# simple thought: don't recurse for Blocks, just check their names
|
||||||
def == other
|
def == other
|
||||||
|
Loading…
x
Reference in New Issue
Block a user