rename for_type to self_type
and split a base class off TypedMethod
This commit is contained in:
@ -30,7 +30,7 @@ module Risc
|
||||
def produce_instructions
|
||||
assert @expect , "No output given"
|
||||
linker = RubyX::RubyXCompiler.new(as_test_main).ruby_to_risc(:interpreter)
|
||||
compiler = linker.assemblers.find{|c| c.method.name == :main and c.method.for_type.object_class.name == :Test}
|
||||
compiler = linker.assemblers.find{|c| c.method.name == :main and c.method.self_type.object_class.name == :Test}
|
||||
compiler.instructions
|
||||
end
|
||||
def check_nil
|
||||
|
@ -16,7 +16,7 @@ module Parfait
|
||||
end
|
||||
|
||||
def test_class_for
|
||||
assert_equal :Object , @method.for_type.object_class.name
|
||||
assert_equal :Object , @method.self_type.object_class.name
|
||||
end
|
||||
|
||||
def test_arg1
|
||||
|
@ -63,8 +63,8 @@ module Risc
|
||||
in_test_vool("def meth; @ivar = 5; @ibar = 4;end")
|
||||
test = Parfait.object_space.get_class_by_name(:Test)
|
||||
method = test.instance_type.get_method(:meth)
|
||||
assert_equal 1, method.for_type.variable_index(:ivar)
|
||||
assert_equal 2, method.for_type.variable_index(:ibar)
|
||||
assert_equal 1, method.self_type.variable_index(:ivar)
|
||||
assert_equal 2, method.self_type.variable_index(:ibar)
|
||||
end
|
||||
def test_typed_method_has_one_local
|
||||
in_test_vool("def meth; local = 5 ; a = 6;end")
|
||||
|
@ -33,7 +33,7 @@ module MomCompile
|
||||
def compile_first_method( input )
|
||||
ret = compile_method( as_test_main( input ))
|
||||
assert_equal Mom::MomCompiler , ret.class
|
||||
compiler = ret.method_compilers.find{|c| c.method.name == :main and c.method.for_type.object_class.name == :Test}
|
||||
compiler = ret.method_compilers.find{|c| c.method.name == :main and c.method.self_type.object_class.name == :Test}
|
||||
assert_equal Risc::MethodCompiler , compiler.class
|
||||
@method.source.to_mom( compiler )
|
||||
end
|
||||
|
Reference in New Issue
Block a user