fix the string warning raises

This commit is contained in:
Torsten Ruger 2015-08-17 02:37:07 +03:00
parent f15f7800b3
commit c039f3d6e6
5 changed files with 11 additions and 11 deletions

View File

@ -38,7 +38,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? Symbol raise "has_var #{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)
@ -46,13 +46,13 @@ 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? Symbol raise "has_arg #{name}.#{name.class}" unless name.is_a? Symbol
self.arg_names.index_of name self.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? Symbol raise "has_local #{name}.#{name.class}" unless name.is_a? Symbol
index = self.locals.index_of(name) index = self.locals.index_of(name)
index = self.tmps.index_of(name) unless index index = self.tmps.index_of(name) unless index
index index

View File

@ -59,7 +59,7 @@ module Parfait
end end
def create_instance_method method_name , arg_names def create_instance_method method_name , arg_names
raise "uups #{method_name}.#{method_name.class}" unless method_name.is_a?(Symbol) raise "create_instance_method #{method_name}.#{method_name.class}" unless method_name.is_a?(Symbol)
clazz = object_layout().object_class() clazz = object_layout().object_class()
raise "??? #{method_name}" unless clazz raise "??? #{method_name}" unless clazz
#puts "Self: #{self.class} clazz: #{clazz.name}" #puts "Self: #{self.class} clazz: #{clazz.name}"
@ -74,7 +74,7 @@ module Parfait
end end
def get_instance_method fname def get_instance_method fname
raise "uups #{fname}.#{fname.class}" unless fname.is_a?(Symbol) raise "get_instance_method #{fname}.#{fname.class}" unless fname.is_a?(Symbol)
#if we had a hash this would be easier. Detect or find would help too #if we had a hash this would be easier. Detect or find would help too
self.instance_methods.each do |m| self.instance_methods.each do |m|
return m if(m.name == fname ) return m if(m.name == fname )
@ -84,7 +84,7 @@ module Parfait
# get the method and if not found, try superclasses. raise error if not found # get the method and if not found, try superclasses. raise error if not found
def resolve_method m_name def resolve_method m_name
raise "uups #{m_name}.#{m_name.class}" unless m_name.is_a?(Symbol) raise "resolve_method #{m_name}.#{m_name.class}" unless m_name.is_a?(Symbol)
method = get_instance_method(m_name) method = get_instance_method(m_name)
return method if method return method if method
if( self.super_class ) if( self.super_class )

View File

@ -60,7 +60,7 @@ module Parfait
# get a class by name (symbol) # get a class by name (symbol)
# return nili if no such class. Use bang version if create should be implicit # return nili if no such class. Use bang version if create should be implicit
def get_class_by_name name def get_class_by_name name
raise "uups #{name}.#{name.class}" unless name.is_a?(Symbol) raise "get_class_by_name #{name}.#{name.class}" unless name.is_a?(Symbol)
c = self.classes[name] c = self.classes[name]
#puts "MISS, no class #{name} #{name.class}" unless c # " #{self.classes}" #puts "MISS, no class #{name} #{name.class}" unless c # " #{self.classes}"
#puts "CLAZZ, #{name} #{c.get_layout.get_length}" if c #puts "CLAZZ, #{name} #{c.get_layout.get_length}" if c
@ -78,7 +78,7 @@ module Parfait
# this is the way to instantiate classes (not Parfait::Class.new) # this is the way to instantiate classes (not Parfait::Class.new)
# so we get and keep exactly one per name # so we get and keep exactly one per name
def create_class name , superclass def create_class name , superclass
raise "uups #{name.class}" unless name.is_a? Symbol raise "create_class #{name.class}" unless name.is_a? Symbol
c = Class.new(name , superclass) c = Class.new(name , superclass)
self.classes[name] = c self.classes[name] = c
end end

View File

@ -39,7 +39,7 @@ module Virtual
def self.compile_modulename expression , method def self.compile_modulename expression , method
clazz = Parfait::Space.object_space.get_class_by_name expression.name clazz = Parfait::Space.object_space.get_class_by_name expression.name
raise "uups #{clazz}.#{name}" unless clazz raise "compile_modulename #{clazz}.#{name}" unless clazz
to = Return.new(Reference , clazz ) to = Return.new(Reference , clazz )
method.source.add_code Set.new( clazz , to ) method.source.add_code Set.new( clazz , to )
to to

View File

@ -35,8 +35,8 @@ 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 "create_method #{class_name}.#{class_name.class}" unless class_name.is_a? Symbol
raise "uups #{method_name}.#{method_name.class}" unless method_name.is_a? Symbol raise "create_method #{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))