I'm experimenting with better forms of OO in PIR.  I want to add a 
get_parents() method on the Class PMC.  Normally, I'd do something like the 
attached patch, but the attached example file I use for testing shows that it 
doesn't work for me.

I dug around a bit and couldn't find a reason for why it shouldn't work.

Note that I can't even call name() on a Class PMC either.  Hm.

-- c
=== src/pmc/parrotclass.pmc
==================================================================
--- src/pmc/parrotclass.pmc	(revision 22961)
+++ src/pmc/parrotclass.pmc	(local)
@@ -325,6 +325,25 @@
         class_data[PCD_MAX + 1] = NULL;
     }
 
+/*
+
+=item C<METHOD PMC* get_parents()>
+
+Returns the array of parents for this class.
+
+=cut
+
+*/
+
+    METHOD PMC* get_parents() {
+        PMC * class;
+        PMC **class_data;
+        
+        class      = SELF;
+        class_data = (PMC**)(PMC_data(class));
+        return class_data[PCD_PARENTS];
+    }
+
 }
 
 /*

Reply via email to