Ticket #882 (closed bug: fixed)
SUPER() not handled correctly for DynPMCs
|Reported by:||flh||Owned by:||cotto|
- Write a base dynpmc foo, and second dynpmc bar which extends the first one.
- Add a init vtable function (or any other) to both dynpmcs.
- In the second (bar) dynpmc's init, call SUPER().
Compilation of the bar dynpmc fails: the compiler complains that enum_class_foo is undefined (this identifier only exists for regular PMCs).
pmc2c actually rewrites SUPER() in the following way:
while we would expect something like that in the case of dynpmcs:
The attached patch fixes that, by checking in MethodEmitted.pm whether the parent PMC is dynamic or not. make test, make fulltest and Rakudo's make test pass.
This patch does not change the emitted code in the case where foo extends a regular PMC and doesn't implement the overridden function (in which case, we can directly emit interp->vtables[enum_class_regular_base_pmc]->init(interp, pmc);).
I don't know if I should also change the code for DYNSUPER, since I'm not sure about DYNSUPER's semantics.