[svn:parrot] r36590 - trunk/src

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Wed Feb 11 20:01:52 UTC 2009


Author: whiteknight
Date: Wed Feb 11 20:01:51 2009
New Revision: 36590
URL: https://trac.parrot.org/parrot/changeset/36590

Log:
[MMD] Tweak the tuple generation code to accept invocant adverbs, in anticipation of some Parrot_PCCINVOKE unifications

Modified:
   trunk/src/multidispatch.c

Modified: trunk/src/multidispatch.c
==============================================================================
--- trunk/src/multidispatch.c	Wed Feb 11 19:53:09 2009	(r36589)
+++ trunk/src/multidispatch.c	Wed Feb 11 20:01:51 2009	(r36590)
@@ -839,13 +839,15 @@
     const INTVAL sig_len    = Parrot_str_byte_length(interp, string_sig);
     INTVAL       tuple_size = 0;
     INTVAL       args_ended = 0;
-    INTVAL       i;
+    INTVAL       i, seen_invocant = 0;
 
     /* First calculate the number of arguments participating in MMD */
     for (i = 0; i < sig_len; ++i) {
         INTVAL type = Parrot_str_indexed(interp, string_sig, i);
         if (type == '-')
             break;
+        if (type == 'i')
+            continue;
 
         tuple_size++;
     }
@@ -853,7 +855,7 @@
     VTABLE_set_integer_native(interp, type_tuple, tuple_size);
 
     for (i = 0; i < sig_len; ++i) {
-        INTVAL type = Parrot_str_indexed(interp, string_sig, i);
+        INTVAL type = Parrot_str_indexed(interp, string_sig, i + seen_invocant);
         if (args_ended)
             break;
 
@@ -879,6 +881,7 @@
                         Parrot_ex_throw_from_c_args(interp, NULL,
                             EXCEPTION_INVALID_OPERATION,
                             "Multiple Dispatch: only the first argument can be an invocant");
+                    seen_invocant = 1;
                 }
                 else {
                     PMC *pmc_arg = VTABLE_get_pmc_keyed_int(interp, sig_obj, i);


More information about the parrot-commits mailing list