Re: [svn:parrot] r21891 - branches/pdd15oo/src/pmc
chromatic wrote: On Friday 05 October 2007 14:02:32 [EMAIL PROTECTED] wrote: Modified: branches/pdd15oo/src/pmc/namespace.pmc === === --- branches/pdd15oo/src/pmc/namespace.pmc (original) +++ branches/pdd15oo/src/pmc/namespace.pmc Fri Oct 5 14:02:31 2007 @@ -182,6 +182,7 @@ Parrot_NSInfo *nsinfo= PARROT_NSINFO(SELF); PMC *vtable= nsinfo-vtable; Parrot_sub*sub = PMC_sub(value); +PMC * const classobj = VTABLE_get_class(interp, SELF); [...] + +/* Insert it in class, if there is a class */ +if (!PMC_IS_NULL(classobj) PObj_is_class_TEST(classobj)) + VTABLE_add_vtable_override(interp, classobj, key, value); } Is there a reason why classobj would *not* be a class if it's not PMCNULL? I don't understand this additional test. Yeah, there could be absolutely any kind of PMC stored in the namespace's 'class' slot. The PObj_is_class_FLAG is something classes set on themselves, agreeing to support the standard interface of a class object. (Currently it's only set by Class and PMCProxy, but it will also be set by the Proto PMC, if/when we add it.) In the future, that may be a check for VTABLE_does of Class, though the flag check is cheaper. Allison
Re: [svn:parrot] r21891 - branches/pdd15oo/src/pmc
On Friday 05 October 2007 14:02:32 [EMAIL PROTECTED] wrote: Author: allison Date: Fri Oct 5 14:02:31 2007 New Revision: 21891 Modified: branches/pdd15oo/src/pmc/namespace.pmc Log: [pdd15oo] The namespace PMC adds methods and vtable overrides to the class if it's associated with a class. Modified: branches/pdd15oo/src/pmc/namespace.pmc === === --- branches/pdd15oo/src/pmc/namespace.pmc (original) +++ branches/pdd15oo/src/pmc/namespace.pmcFri Oct 5 14:02:31 2007 @@ -182,6 +182,7 @@ Parrot_NSInfo *nsinfo= PARROT_NSINFO(SELF); PMC *vtable= nsinfo-vtable; Parrot_sub*sub = PMC_sub(value); +PMC * const classobj = VTABLE_get_class(interp, SELF); /* Handle vtable methods with two underscores at the start. */ if (sub-vtable_index == -1) { @@ -202,9 +203,14 @@ /* Insert it. */ VTABLE_set_pmc_keyed_int(INTERP, vtable, sub-vtable_index, value); + +/* Insert it in class, if there is a class */ +if (!PMC_IS_NULL(classobj) PObj_is_class_TEST(classobj)) + VTABLE_add_vtable_override(interp, classobj, key, value); } Is there a reason why classobj would *not* be a class if it's not PMCNULL? I don't understand this additional test. -- c