small rename

This commit is contained in:
Torsten Ruger 2016-12-19 14:16:10 +02:00
parent 107e3e6d58
commit af9fed863f
5 changed files with 8 additions and 8 deletions

View File

@ -111,7 +111,7 @@ module Typed
raise "create_method #{type.inspect} is not a Type" unless type.is_a? Parfait::Type
raise "Args must be Hash #{args}" unless args.is_a?(Hash)
raise "create_method #{method_name}.#{method_name.class}" unless method_name.is_a? Symbol
arguments = Parfait::Type.new_for_hash( type.object_class , args )
arguments = Parfait::Type.for_hash( type.object_class , args )
@method = type.create_instance_method( method_name , arguments)
self
end

View File

@ -38,7 +38,7 @@ module Parfait
include Indexed
self.offset(3)
def self.new_for_hash( object_class , hash)
def self.for_hash( object_class , hash)
new_type = Type.new( object_class , hash)
code = new_type.hash
Space.object_space.types[code] = new_type
@ -83,7 +83,7 @@ module Parfait
def create_instance_method( method_name , arguments )
raise "create_instance_method #{method_name}.#{method_name.class}" unless method_name.is_a?(Symbol)
#puts "Self: #{self.class} clazz: #{clazz.name}"
arguments = Parfait::Type.new_for_hash( self.object_class , arguments) if arguments.is_a?(Hash)
arguments = Parfait::Type.for_hash( self.object_class , arguments) if arguments.is_a?(Hash)
add_instance_method TypedMethod.new( self , method_name , arguments )
end
@ -138,7 +138,7 @@ module Parfait
if existing
return existing
else
return Type.new_for_hash( object_class , hash)
return Type.for_hash( object_class , hash)
end
end

View File

@ -8,7 +8,7 @@ class TestMeta < MiniTest::Test
end
def foo_method for_class = :Try
args = Parfait::Type.new_for_hash( @try , { bar: :Integer})
args = Parfait::Type.for_hash( @try , { bar: :Integer})
::Parfait::TypedMethod.new @space.get_class_by_name(for_class).instance_type , :foo , args
end

View File

@ -4,7 +4,7 @@ class TestMethod < MiniTest::Test
def setup
obj = Register.machine.space.get_class_by_name(:Object).instance_type
args = Parfait::Type.new_for_hash( obj , { bar: :Integer , foo: :Type})
args = Parfait::Type.for_hash( obj , { bar: :Integer , foo: :Type})
@method = ::Parfait::TypedMethod.new obj , :meth , args
@method.add_local :local_bar , :Integer
@method.add_local :local_foo , :Type

View File

@ -8,7 +8,7 @@ class TestMethodApi < MiniTest::Test
end
def foo_method for_class = :Try
args = Parfait::Type.new_for_hash( @try , { bar: :Integer})
args = Parfait::Type.for_hash( @try , { bar: :Integer})
::Parfait::TypedMethod.new @space.get_class_by_name(for_class).instance_type , :foo , args
end
@ -33,7 +33,7 @@ class TestMethodApi < MiniTest::Test
end
end
def test_create_method
args = Parfait::Type.new_for_hash( @try , { bar: :Integer})
args = Parfait::Type.for_hash( @try , { bar: :Integer})
@try.create_instance_method :bar, args
assert_equal ":bar" , @try.method_names.inspect
end