[svn:parrot] r42131 - trunk/src/call

NotFound at svn.parrot.org NotFound at svn.parrot.org
Mon Oct 26 23:43:40 UTC 2009


Author: NotFound
Date: Mon Oct 26 23:43:39 2009
New Revision: 42131
URL: https://trac.parrot.org/parrot/changeset/42131

Log:
[pcc] allow Parrot_pcc_invoke_from_sig_object to take a PMC that isa Sub or does invokable

Modified:
   trunk/src/call/pcc.c

Modified: trunk/src/call/pcc.c
==============================================================================
--- trunk/src/call/pcc.c	Mon Oct 26 23:24:43 2009	(r42130)
+++ trunk/src/call/pcc.c	Mon Oct 26 23:43:39 2009	(r42131)
@@ -204,6 +204,26 @@
 
 /*
 
+=item C<static int is_invokable(PARROT_INTERP, PMC *sub_obj)>
+
+Check if the PMC is a Sub or does invokable. Helper for do_run_ops.
+
+=cut
+
+*/
+
+PARROT_INLINE
+static int
+is_invokable(PARROT_INTERP, ARGIN(PMC*sub_obj)) /* HEADERIZER SKIP */
+{
+    if (VTABLE_isa(interp, sub_obj, CONST_STRING(interp, "Sub")))
+        return 1;
+    else
+        return VTABLE_does(interp, sub_obj, CONST_STRING(interp, "invokable"));
+}
+
+/*
+
 =item C<static int do_run_ops(PARROT_INTERP, PMC *sub_obj)>
 
 Check should we run ops.
@@ -213,6 +233,7 @@
 =cut
 
 */
+
 static int
 do_run_ops(PARROT_INTERP, ARGIN(PMC *sub_obj))
 {
@@ -220,20 +241,12 @@
     if (!PMC_IS_NULL(interp->current_object))
         return 0;
 
-    if (sub_obj->vtable->base_type == enum_class_Sub
-         || sub_obj->vtable->base_type == enum_class_MultiSub
-         || sub_obj->vtable->base_type == enum_class_Eval)
-        return 1;
-
-    /* No more core PMC to run ops */
     if (sub_obj->vtable->base_type < enum_class_core_max)
-        return 0;
-
-    /* But we can have inherited */
-    if (VTABLE_isa(interp, sub_obj, CONST_STRING(interp, "Sub")))
-        return 1;
-
-    return 0;
+        return sub_obj->vtable->base_type == enum_class_Sub
+            || sub_obj->vtable->base_type == enum_class_MultiSub
+            || sub_obj->vtable->base_type == enum_class_Eval;
+    else
+        return is_invokable(interp, sub_obj);
 }
 
 /*


More information about the parrot-commits mailing list