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