develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35103 - branches/cc_restart/src

From:
allison
Date:
January 7, 2009 00:42
Subject:
[svn:parrot] r35103 - branches/cc_restart/src
Message ID:
20090107084202.122B8CB9F9@x12.develooper.com
Author: allison
Date: Wed Jan  7 00:42:00 2009
New Revision: 35103

Modified:
   branches/cc_restart/src/multidispatch.c

Log:
[calling_conventions] Add handling for invocants when generating an MMD
type_tuple from a CallSignature object.


Modified: branches/cc_restart/src/multidispatch.c
==============================================================================
--- branches/cc_restart/src/multidispatch.c	(original)
+++ branches/cc_restart/src/multidispatch.c	Wed Jan  7 00:42:00 2009
@@ -1252,13 +1252,22 @@
                 break;
             case 'P':
             {
-                PMC *pmc_arg = VTABLE_get_pmc_keyed_int(interp, sig_obj, i);
-                if (PMC_IS_NULL(pmc_arg))
-                    VTABLE_set_integer_keyed_int(interp, type_tuple,
-                            i, enum_type_PMC);
-                else
-                    VTABLE_set_integer_keyed_int(interp, type_tuple, i,
-                            VTABLE_type(interp, pmc_arg));
+                INTVAL type_lookahead = string_index(interp, string_sig, (i + 1));
+                if (type_lookahead == 'i') {
+                    if (i != 0)
+                        Parrot_ex_throw_from_c_args(interp, NULL,
+                            EXCEPTION_INVALID_OPERATION,
+                            "Multiple Dispatch: only the first argument can be an invocant");
+                }
+                else {
+                    PMC *pmc_arg = VTABLE_get_pmc_keyed_int(interp, sig_obj, i);
+                    if (PMC_IS_NULL(pmc_arg))
+                        VTABLE_set_integer_keyed_int(interp, type_tuple,
+                                i, enum_type_PMC);
+                    else
+                        VTABLE_set_integer_keyed_int(interp, type_tuple, i,
+                                VTABLE_type(interp, pmc_arg));
+                }
 
                 break;
             }



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About