fun is_intro: Bool do return mproperty.intro == self
# Return the next definition in linearization of `mtype`.
- # If there is no next method then null is returned.
#
# This method is used to determine what method is called by a super.
#
- # FIXME: NOT YET IMPLEMENTED
+ # FIXME: IMPLEMENTED AS A static designation, it is ugly
#
# REQUIRE: not mtype.need_anchor
- fun lookup_next_definition(mmodule: MModule, mtype: MType): nullable MPROPDEF
+ fun lookup_next_definition(mmodule: MModule, mtype: MType): MPROPDEF
do
assert not mtype.need_anchor
- return null
+
+ var mpropdefs = self.mproperty.lookup_super_definitions(self.mclassdef.mmodule, self.mclassdef.bound_mtype)
+ assert not mpropdefs.is_empty
+ if mpropdefs.length > 1 then
+ print "BADLINEXT chose next {mpropdefs.first} in: {mpropdefs.join(", ")}"
+ end
+ return mpropdefs.first
end
end
# stantard call-next-method
var mpropdef = v.frame.mpropdef
# FIXME: we do not want an ugly static call!
- var mpropdefs = mpropdef.mproperty.lookup_super_definitions(mpropdef.mclassdef.mmodule, mpropdef.mclassdef.bound_mtype)
- if mpropdefs.length != 1 then
- debug("Warning: NOT YET IMPLEMENTED: multiple MPRODFEFS for super {mpropdef} for {recv}: {mpropdefs.join(", ")}")
- end
- mpropdef = mpropdefs.first
+ mpropdef = mpropdef.lookup_next_definition(v.mainmodule, recv.mtype)
assert mpropdef isa MMethodDef
var res = v.call(mpropdef, args)
return res