more class test and misc

This commit is contained in:
2019-09-21 18:07:58 +03:00
parent 113ba8607c
commit 3b7248df4e
5 changed files with 55 additions and 3 deletions

View File

@ -44,6 +44,9 @@ module Parfait
def inspect
"Class(#{name})"
end
def to_s
inspect
end
def add_method_for(name , type , frame , body )
method = Parfait::VoolMethod.new(name , type , frame , body )

View File

@ -29,7 +29,6 @@ module Parfait
def initialize( clazz )
super()
@clazz = clazz
@instance_methods = List.new
@instance_type = Object.object_space.get_type_by_class_name(:Object)
end
@ -41,6 +40,9 @@ module Parfait
"MetaClass(#{@clazz.name})"
end
def to_s
inspect
end
def add_method_for(name , type , frame , body )
method = Parfait::VoolMethod.new(name , type , frame , body )
add_method( method )

View File

@ -127,7 +127,7 @@ module Parfait
end
method.set_next( @methods )
@methods = method
#puts "#{self.name} add #{method.name}"
# puts "ADD method to #{self.inspect}:#{method.name}"
method
end
@ -167,9 +167,9 @@ module Parfait
def resolve_method( fname )
method = get_method(fname)
return method if method
return nil if object_class.name == :Object
sup = object_class.super_class
return nil unless sup
return nil if object_class.name == :Object
sup.instance_type.resolve_method(fname)
end

View File

@ -11,6 +11,7 @@ module Vool
raise "not meta" unless clazz.class == Parfait::MetaClass
raise( "no class in #{self}") unless clazz
method = clazz.add_method_for(name , make_arg_type , make_frame , body )
#puts "CLass method Class:#{clazz}:#{name}"
compiler = method.compiler_for(clazz.instance_type)
each {|node| raise "Blocks not implemented" if node.is_a?(LambdaExpression)}
compiler