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
|
||||
# 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
|
||||
|
||||
|
@ -36,7 +36,7 @@ module Virtual
|
||||
# compile code then works with the method, but adds code tot the info
|
||||
def self.create_method( class_name , method_name , args)
|
||||
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
|
||||
raise "No such class #{class_name}" unless clazz
|
||||
method = clazz.create_instance_method( method_name , Virtual.new_list(args))
|
||||
|
@ -18,10 +18,10 @@ module Virtual
|
||||
r = Self.new()
|
||||
class_name = method.for_class.name
|
||||
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.for_class.add_instance_method new_method
|
||||
|
||||
|
||||
#frame = frame.new_frame
|
||||
return_type = nil
|
||||
expression.body.each do |ex|
|
||||
|
@ -30,6 +30,18 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'test'))
|
||||
|
||||
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
|
||||
def == other
|
||||
return false unless other.class == self.class
|
||||
|
@ -28,17 +28,7 @@ module VirtualHelper
|
||||
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
|
||||
# simple thought: don't recurse for Blocks, just check their names
|
||||
def == other
|
||||
|
Loading…
Reference in New Issue
Block a user