Skip to content

Commit

Permalink
Ensure error messages for 'method not found' and 'vtable not implemen…
Browse files Browse the repository at this point in the history
…ted' include the class name, not just SixModelObject.
  • Loading branch information
jnthn committed Jun 15, 2011
1 parent 00a7fe4 commit ecc33ba
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/pmc/sixmodelobject.pmc
Expand Up @@ -90,6 +90,28 @@ pmclass SixModelObject manual_attrs dynpmc group nqp {
REPR(SELF)->bind_attribute(interp, SELF, handle, name, NO_HINT, value);
}

VTABLE STRING * name() {
return VTABLE_get_string(interp, VTABLE_get_class(interp, SELF));
}

VTABLE PMC * get_class() {
PMC *decont = decontainerize(interp, SELF);
PMC *how = STABLE(decont)->HOW;
PMC *name_meth = VTABLE_find_method(interp, how, CONST_STRING(interp, "name"));
if (!PMC_IS_NULL(name_meth)) {
PMC *old_ctx = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
PMC *cappy = Parrot_pmc_new(interp, enum_class_CallContext);
VTABLE_push_pmc(interp, cappy, how);
VTABLE_push_pmc(interp, cappy, decont);
Parrot_pcc_invoke_from_sig_object(interp, name_meth, cappy);
cappy = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), old_ctx);
return VTABLE_get_pmc_keyed_int(interp, cappy, 0);
}
else
return SUPER();
}

/* XXX Hack for Parrot issue which needs invokable on stuff. */
VTABLE INTVAL does(STRING *what) {
return Parrot_str_equal(interp, what, CONST_STRING(interp, "invokable"));
Expand Down

0 comments on commit ecc33ba

Please sign in to comment.