fix more api ripples from typed method

This commit is contained in:
Torsten Ruger 2018-03-18 22:37:43 +05:30
parent 9989cc12e0
commit 8c53b4ab67
2 changed files with 7 additions and 5 deletions

View File

@ -5,9 +5,8 @@ class TestMethod < MiniTest::Test
def setup
obj = Parfait.object_space.get_class_by_name(:Object).instance_type
args = Parfait::Type.for_hash( obj.object_class , { bar: :Integer , foo: :Type})
@method = ::Parfait::TypedMethod.new obj , :meth , args
@method.add_local :local_bar , :Integer
@method.add_local :local_foo , :Type
frame = Parfait::Type.for_hash( obj.object_class , { local_bar: :Integer , local_foo: :Type})
@method = Parfait::TypedMethod.new( obj , :meth , args , frame)
end
def test_method_name

View File

@ -9,9 +9,12 @@ class TestMethodApi < MiniTest::Test
@try_type = @try_class.instance_type
end
def empty_frame
Parfait::Type.for_hash( @try_class , { })
end
def foo_method( for_class = :Try)
args = Parfait::Type.for_hash( @try_class , { bar: :Integer})
::Parfait::TypedMethod.new @space.get_class_by_name(for_class).instance_type , :foo , args
::Parfait::TypedMethod.new( @space.get_class_by_name(for_class).instance_type , :foo , args,empty_frame)
end
def add_foo_to( clazz = :Try )
foo = foo_method( clazz )
@ -42,7 +45,7 @@ class TestMethodApi < MiniTest::Test
end
def test_create_method
args = Parfait::Type.for_hash( @try_class , { bar: :Integer})
@try_type.create_method :bar, args
@try_type.create_method :bar, args , empty_frame
assert @try_type.method_names.inspect.include?("bar")
end
def test_method_get