id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,lang,patch,platform
882,SUPER() not handled correctly for DynPMCs,flh,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:
  interp->vtables[enum_class_foo]->init(interp, pmc);
while we would expect something like that in the case of dynpmcs:
  Parrot_foo_get_vtable(interp)->init(interp, pmc);

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.",bug,closed,normal,,pmc2c,trunk,medium,fixed,,,,new,all
