Author: Whiteknight
Date: Thu Aug 21 15:20:36 2008
New Revision: 30431

Modified:
   branches/pdd27mmd/src/pmc/multisub.pmc

Log:
[pdd27mmd] Add a basic (and probably wrong) implementation of the 
MultiSub.get_iter method.

Modified: branches/pdd27mmd/src/pmc/multisub.pmc
==============================================================================
--- branches/pdd27mmd/src/pmc/multisub.pmc      (original)
+++ branches/pdd27mmd/src/pmc/multisub.pmc      Thu Aug 21 15:20:36 2008
@@ -88,7 +88,8 @@
 
     /* I don't really know how to implement these if they need something
        special, so I'll sort the sub list and defer processing to the
-       ResizablePMCArray's VTABLE methods of the same names */
+       ResizablePMCArray's VTABLE methods of the same names. Hopefully we
+       don't need anything beyond that. */
     VTABLE PMC *get_pmc_keyed(PMC *key) {
         PMC *  list = Parrot_mmd_sort_manhattan(INTERP, SELF);
         if(PMC_IS_NULL(list))
@@ -103,24 +104,25 @@
         return VTABLE_get_pmc_keyed_string(INTERP, SELF, s);
     }
 
-    /* stub get_iter method. Takes an argument list PMC, sorts the subs in the
+    /* Naive get_iter method. Takes an argument list PMC, sorts the subs in the
        multi according to the closeness to that list, and returns an iterator
        over the sorted list of subs. Or, it could take a string PMC where
        type letters (P S N I) are whitespace delimited. */
-/*
+
     METHOD PMC *get_iter(PMC *args) {
         STRING * const _array  = CONST_STRING(interp, "Array");
         STRING * const _string = CONST_STRING(interp, "String");
 
         if (VTABLE_isa(INTERP, args, _array))
             return VTABLE_get_pmc_keyed(INTERP, SELF, args);
-        else if (VTABLE_isa(INTERP, args, _string))
-            return VTABLE_get_pmc_keyed_string(INTERP, SELF, args);
+        else if (VTABLE_isa(INTERP, args, _string)) {
+            STRING * const s = VTABLE_get_string(args);
+            return VTABLE_get_pmc_keyed_string(INTERP, SELF, s);
+        }
         else
             Parrot_ex_throw_from_c_args(interp, NULL, 
EXCEPTION_INVALID_OPERATION,
                     "attempt to call get_iter method with invalid arg 
type.\n");
     }
-*/
 }
 
 /*

Reply via email to