I have the following class structure:
class A { mixed foo() { }
class AA { mixed foo() { return A::foo(); // Implemented with apply_external(1, f_A_foo_fun_num, args); } } }
class B { inherit A; class BB { inherit A::AA; } }
class C { inherit B; }
class D { inherit C; class BB { inherit C::BB; } }
But with A, B and C implemented in a cmod. A::AA and B::BB are marked as PROGRAM_USES_PARENT.
My problem is that when foo() is called in D()->BB(), find_external_context() returns a loc.inherit with an inherit_level of zero, which causes apply_external() to call the wrong identifier. As far as I can see, the problem might lie in the default branch of find_external_context() after the recursive call:
apply_external(1, 1, 4)... -find_external_context(1, inherit=2) - i->parent_offset=1 i->parent_identifier=0 - o->parent_identifier=0 inherit->identifier_level=2 - inherit-- (2 >= 2) -find_external_context(1, inherit=1) - i->parent_offset=1 i->parent_identifier=80 - o->parent_identifier=0 inherit->identifier_level=0 - inherit-- (1 >= 1) -find_external_context(1, inherit=0) - i->parent_offset=-18 i->parent_identifier=-1 - o->parent_identifier=0 inherit->identifier_level=0 - Following o->parent - Parent identifier = 0 (BB), inherit # = 0 --find_external_context: parent_id=0 (BB) * inh->parent_identifier: 80 * loc->parent_identifier: 0 * loc->inherit->parent_offset: -18 * loc->inherit->identifier_level: 0 * parent_identifier: 80 - Parent identifier = 80 (BB), inherit # = 2 --find_external_context: parent_id=80 (BB) * inh->parent_identifier: 0 * loc->parent_identifier: 80 * loc->inherit->parent_offset: 0 * loc->inherit->identifier_level: 0 * parent_identifier: 0 - Parent identifier = 0 (BB), inherit # = 0 --find_external_context: parent_id=0 (BB) apply_external(1, 1, 4) ==> apply_low(0x83c5750, 1, 4) Too many arguments to create(). Expected at most 1 (got 4).
Does anybody know in what step it has gone wrong?