diff --git a/lib/vm/method_compiler/name_expression.rb b/lib/vm/method_compiler/name_expression.rb index 83a50728..3be9d5c1 100644 --- a/lib/vm/method_compiler/name_expression.rb +++ b/lib/vm/method_compiler/name_expression.rb @@ -10,7 +10,7 @@ module Vm [:self , :space , :message].each do |special| return send(:"load_special_#{special}" , statement ) if name == special end - return load_argument(statement) if( @method.has_arg(name)) + return load_argument(statement) if( @method.has_argument(name)) load_local(statement) end @@ -18,9 +18,9 @@ module Vm def load_argument(statement) name = statement.name - index = @method.has_arg(name) + index = @method.has_argument(name) named_list = use_reg :NamedList - ret = use_reg @method.argument_type(index) + ret = use_reg @method.arguments_type(index) #puts "For #{name} at #{index} got #{@method.arguments.inspect}" add_slot_to_reg("#{statement} load args" , :message , :arguments, named_list ) add_slot_to_reg("#{statement} load #{name}" , named_list , index + 1, ret ) diff --git a/lib/vm/parfait/typed_method.rb b/lib/vm/parfait/typed_method.rb index c553f425..12ba43d2 100644 --- a/lib/vm/parfait/typed_method.rb +++ b/lib/vm/parfait/typed_method.rb @@ -44,8 +44,8 @@ module Parfait end # determine whether this method has an argument by the name - def has_arg( name ) - raise "has_arg #{name}.#{name.class}" unless name.is_a? Symbol + def has_argument( name ) + raise "has_argument #{name}.#{name.class}" unless name.is_a? Symbol index = arguments.variable_index( name ) index ? (index - 1) : index end @@ -61,7 +61,7 @@ module Parfait def argument_name( index ) arguments.names.get(index + 1) end - def argument_type( index ) + def arguments_type( index ) arguments.types.get(index + 1) end diff --git a/test/vm/parfait/test_typed_method.rb b/test/vm/parfait/test_typed_method.rb index e8ff97c9..24cb1b19 100644 --- a/test/vm/parfait/test_typed_method.rb +++ b/test/vm/parfait/test_typed_method.rb @@ -24,35 +24,35 @@ class TestMethod < MiniTest::Test assert_equal :bar , @method.argument_name(1) end - def test_has_arg - assert_equal 1 , @method.has_arg(:bar) - assert_equal 2 , @method.has_arg(:foo) + def test_has_argument + assert_equal 1 , @method.has_argument(:bar) + assert_equal 2 , @method.has_argument(:foo) end def test_add_arg @method.add_argument(:foo2 , :Object) assert_equal 3 , @method.arguments_length assert_equal :foo2 , @method.argument_name(3) - assert_equal :Object , @method.argument_type(3) + assert_equal :Object , @method.arguments_type(3) end def test_get_arg_name1 - index = @method.has_arg(:bar) + index = @method.has_argument(:bar) assert_equal 1 , index assert_equal :bar , @method.argument_name(index) end def test_get_arg_type1 - index = @method.has_arg(:bar) - assert_equal :Integer , @method.argument_type(index) + index = @method.has_argument(:bar) + assert_equal :Integer , @method.arguments_type(index) end def test_get_arg_name2 - index = @method.has_arg(:foo) + index = @method.has_argument(:foo) assert_equal 2 , index assert_equal :foo , @method.argument_name(index) end def test_get_arg_type2 - index = @method.has_arg(:foo) - assert_equal :Type , @method.argument_type(index) + index = @method.has_argument(:foo) + assert_equal :Type , @method.arguments_type(index) end def test_local1