Author: chromatic
Date: Tue May  6 12:11:21 2008
New Revision: 27355

Modified:
   trunk/compilers/imcc/pbc.c
   trunk/src/ops/core.ops
   trunk/src/ops/experimental.ops

Log:
[PIR] Improved the error message for invoking a non-existent dynamic sub (fixes
RT #49972).

Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c  (original)
+++ trunk/compilers/imcc/pbc.c  Tue May  6 12:11:21 2008
@@ -655,7 +655,7 @@
                     SymReg * const nam = mk_const(interp, fixup->name,
                             fixup->type & VT_ENCODED ? 'U' : 'S');
 
-                    op = interp->op_lib->op_code("find_name_p_sc", 1);
+                    op = interp->op_lib->op_code("find_sub_not_null_p_sc", 1);
                     PARROT_ASSERT(op);
 
                     interp->code->base.data[addr] = op;

Modified: trunk/src/ops/core.ops
==============================================================================
--- trunk/src/ops/core.ops      (original)
+++ trunk/src/ops/core.ops      Tue May  6 12:11:21 2008
@@ -405,12 +405,13 @@
 =cut
 
 inline op invokecc(invar PMC) :flow {
-    opcode_t *dest;
-    PMC * const p = $1;
-    dest = expr NEXT();
+    PMC      * const p     = $1;
+    opcode_t *dest         = expr NEXT();
+
     interp->current_object = NULL;
-    interp->current_cont = NEED_CONTINUATION;
-    dest = (opcode_t *)p->vtable->invoke(interp, p, dest);
+    interp->current_cont   = NEED_CONTINUATION;
+    dest                   = (opcode_t *)p->vtable->invoke(interp, p, dest);
+
     goto ADDRESS(dest);
 }
 

Modified: trunk/src/ops/experimental.ops
==============================================================================
--- trunk/src/ops/experimental.ops      (original)
+++ trunk/src/ops/experimental.ops      Tue May  6 12:11:21 2008
@@ -412,6 +412,17 @@
   $1 = string_substr(interp, $2, $3, $4, &dest, 1);
 }
 
+=item C<find_sub_not_null>(out PMC, in STR)
+
+inline op find_sub_not_null(out PMC, in STR) :base_core {
+    PMC *sub = Parrot_find_name_op(interp, $2, expr NEXT());
+
+    if (PMC_IS_NULL(sub))
+        real_exception(interp, NULL, GLOBAL_NOT_FOUND,
+            "Could not invoke non-existent sub %Ss", $2);
+
+    $1 = sub;
+}
 
 =back
 

Reply via email to