Author: Whiteknight
Date: Sat Jan 17 13:01:19 2009
New Revision: 35707
Modified:
trunk/src/oo.c
trunk/src/pmc.c
Log:
[get_class] Undoing some of my earlier changes. We can't unify this as easily as I had hoped because there are too many different types of objects coming down the pipeline that I can't keep track of. Will try again later maybe
Modified: trunk/src/oo.c
==============================================================================
--- trunk/src/oo.c (original)
+++ trunk/src/oo.c Sat Jan 17 13:01:19 2009
@@ -221,8 +221,18 @@
/* If the PMCProxy doesn't exist yet for the given key, we look up the
type ID here and create a new one */
if (PMC_IS_NULL(classobj)) {
- /* Look up a low-level class and create a proxy */
- const INTVAL type = pmc_type_p(interp, key);
+ INTVAL type;
+ const INTVAL base_type = key->vtable->base_type;
+
+ /* XXX TT#182: This is a hack! We should be able to treat all
+ PMC types the same through pmc_type_p or some interface to it */
+ if (base_type == enum_class_Key
+ || base_type == enum_class_ResizableStringArray
+ || base_type == enum_class_String
+ || base_type == enum_class_NameSpace)
+ type = pmc_type_p(interp, key);
+ else
+ type = pmc_type(interp, VTABLE_get_string(interp, key));
/* Reject invalid type numbers */
if (type > interp->n_vtable_max || type <= 0)
Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c (original)
+++ trunk/src/pmc.c Sat Jan 17 13:01:19 2009
@@ -633,12 +633,6 @@
else
return 0;
}
- else if (name->vtable->base_type == enum_class_Role)
- /* This is a bit of a hack for now. Stringification is imprecise, and
- we sholdn't be relying on that to find unique class IDs in all
- cases. */
- return pmc_type(interp, VTABLE_get_string(interp, name));
-
item = (PMC *)VTABLE_get_pointer_keyed(interp, classname_hash, name);
if (!PMC_IS_NULL(item))