[svn:parrot] r42222 - in trunk: src/pmc t/pmc

pmichaud at svn.parrot.org pmichaud at svn.parrot.org
Mon Nov 2 16:32:07 UTC 2009


Author: pmichaud
Date: Mon Nov  2 16:32:07 2009
New Revision: 42222
URL: https://trac.parrot.org/parrot/changeset/42222

Log:
Fix MultiSub PMCs so that they stringify to the name
of their first candidate instead of the number of candidates.
Also change the "No applicable methods" exception to be
much more informative, by reporting "No applicable candidates
found to dispatch to for '$subname'."

Modified:
   trunk/src/pmc/multisub.pmc
   trunk/t/pmc/multidispatch.t

Modified: trunk/src/pmc/multisub.pmc
==============================================================================
--- trunk/src/pmc/multisub.pmc	Mon Nov  2 16:04:57 2009	(r42221)
+++ trunk/src/pmc/multisub.pmc	Mon Nov  2 16:32:07 2009	(r42222)
@@ -23,6 +23,12 @@
 
 pmclass MultiSub extends ResizablePMCArray auto_attrs provides array {
 
+    VTABLE STRING * get_string() {
+        PMC * const sub0    = VTABLE_get_pmc_keyed_int(INTERP, SELF, 0);
+        STRING * const name = VTABLE_get_string(INTERP, sub0);
+        return name;
+    }
+
     VTABLE void push_pmc(PMC *value) {
         STRING * const _sub = CONST_STRING(interp, "Sub");
         STRING * const _nci = CONST_STRING(interp, "NCI");
@@ -64,8 +70,9 @@
                 SELF, sig_obj);
 
         if (PMC_IS_NULL(func))
-            Parrot_ex_throw_from_c_args(INTERP, NULL, 1, "No applicable methods.\n");
-
+            Parrot_ex_throw_from_c_args(INTERP, NULL, 1, 
+                    "No applicable candidates found to dispatch to for '%Ss'",
+                    VTABLE_get_string(interp, SELF));
         return VTABLE_invoke(INTERP, func, next);
     }
 
@@ -80,7 +87,9 @@
                 SELF, sig_obj);
 
         if (PMC_IS_NULL(sub))
-            Parrot_ex_throw_from_c_args(INTERP, NULL, 1, "No applicable methods.\n");
+            Parrot_ex_throw_from_c_args(INTERP, NULL, 1, 
+                    "No applicable candidates found to dispatch to for '%Ss'",
+                    VTABLE_get_string(interp, SELF));
         return SUPER(key);
     }
 
@@ -90,7 +99,9 @@
                 SELF, sig_obj);
 
         if (PMC_IS_NULL(sub))
-            Parrot_ex_throw_from_c_args(INTERP, NULL, 1, "No applicable methods.\n");
+            Parrot_ex_throw_from_c_args(INTERP, NULL, 1, 
+                    "No applicable candidates found to dispatch to for '%Ss'",
+                    VTABLE_get_string(interp, SELF));
         return SUPER(s);
     }
 

Modified: trunk/t/pmc/multidispatch.t
==============================================================================
--- trunk/t/pmc/multidispatch.t	Mon Nov  2 16:04:57 2009	(r42221)
+++ trunk/t/pmc/multidispatch.t	Mon Nov  2 16:32:07 2009	(r42222)
@@ -413,7 +413,7 @@
 .end
 CODE
 /\A\(_, Float\) method:  1, 9\.5
-No applicable methods/
+No applicable candidates/
 OUT
 
 pir_output_is( <<'CODE', <<'OUT', "MMD on argument count" );
@@ -583,7 +583,7 @@
 PSt ok 2
 PSt ok 3
 String ok 4
-No applicable methods/
+No applicable candidates/
 OUT
 
 pir_output_is( <<'CODE', <<'OUT', 'MMD on PMC types 3' );


More information about the parrot-commits mailing list