Starting to fix resolve mechanism

resolve had the wrong approach, sort of class based oo
It took methods from "derived" types and just used them
To be correct, those methods would have to be recompiled for the current type, rubyx is type, not class based.
Started on that, still soe strange hang though

Later, type and method analysis may reveal "compatible" types (down only off course) where one could use the exact same code, but that is phase 2
This commit is contained in:
2019-09-29 12:06:37 +03:00
parent 1e5073200c
commit 17f87f7464
9 changed files with 51 additions and 38 deletions

View File

@ -48,7 +48,7 @@ module Parfait
# or the super classs is nil.
# Use only for non Object base class
def super_class!
raise "No super_class for class #{@name}" unless @super_class_name
raise "No super_class for class #{@name}" if is_object?
s = super_class
raise "superclass not found for class #{@name} (#{@super_class_name})" unless s
s
@ -58,10 +58,13 @@ module Parfait
# we only store the name, and so have to resolve.
# Nil name means no superclass, and so nil is a valid return value
def super_class
return nil unless @super_class_name
return nil if is_object?
Object.object_space.get_class_by_name(@super_class_name)
end
def is_object?
@name == :Object
end
# ruby 2.1 list (just for reference, keep at bottom)
#:allocate, :new, :superclass