diff --git a/lib/parfait/method.rb b/lib/parfait/method.rb index 9c4c9d16..4cda023b 100644 --- a/lib/parfait/method.rb +++ b/lib/parfait/method.rb @@ -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 diff --git a/lib/virtual/compiled_method_info.rb b/lib/virtual/compiled_method_info.rb index 12f544c0..bde31be3 100644 --- a/lib/virtual/compiled_method_info.rb +++ b/lib/virtual/compiled_method_info.rb @@ -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)) diff --git a/lib/virtual/compiler/function_expression.rb b/lib/virtual/compiler/function_expression.rb index 5db446da..86746468 100644 --- a/lib/virtual/compiler/function_expression.rb +++ b/lib/virtual/compiler/function_expression.rb @@ -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| diff --git a/test/helper.rb b/test/helper.rb index 255fadab..cbdc6bc5 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -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 diff --git a/test/virtual/virtual_helper.rb b/test/virtual/virtual_helper.rb index ad7cfaec..f8016083 100644 --- a/test/virtual/virtual_helper.rb +++ b/test/virtual/virtual_helper.rb @@ -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