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

@ -152,21 +152,6 @@ module Parfait
nil
end
# resolve according to normal oo logic, ie look up in superclass if not present
# NOTE: this will probably not work in future as the code for the superclass
# method, being bound to a different type, will assume that types (not the run-time
# actual types) layout. Either need to enforce some c++ style upwards compatibility (buuh)
# or copy the methods and recompile them for the actual type. (maybe still later dynamically)
# But for now we walk up, as it should really just be to object
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
sup.instance_type.resolve_method(fname)
end
def methods_length
return 0 unless @methods
len = 0