cvsuser 04/09/21 05:25:39
Modified: classes eval.pmc
t/pmc eval.t
Log:
fix 31467 eval example
Revision Changes Path
1.28 +2 -3 parrot/classes/eval.pmc
Index: eval.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/eval.pmc,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -w -r1.27 -r1.28
--- eval.pmc 20 Jul 2004 06:52:00 -0000 1.27
+++ eval.pmc 21 Sep 2004 12:25:38 -0000 1.28
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: eval.pmc,v 1.27 2004/07/20 06:52:00 leo Exp $
+$Id: eval.pmc,v 1.28 2004/09/21 12:25:38 leo Exp $
=head1 NAME
@@ -52,8 +52,7 @@
void* invoke (void* next) {
struct PackFile_ByteCode *old_cs;
- /* invoke on Sub returns the address */
- struct PackFile *eval_pf = (struct PackFile *)SUPER(next);
+ struct PackFile *eval_pf = (struct PackFile *)PMC_struct_val(SELF);
#if EXEC_CAPABLE
extern int Parrot_exec_run;
if (Interp_core_TEST(interpreter, PARROT_EXEC_CORE)) {
1.9 +36 -2 parrot/t/pmc/eval.t
Index: eval.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/eval.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -r1.8 -r1.9
--- eval.t 30 Aug 2004 12:12:33 -0000 1.8
+++ eval.t 21 Sep 2004 12:25:39 -0000 1.9
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: eval.t,v 1.8 2004/08/30 12:12:33 leo Exp $
+# $Id: eval.t,v 1.9 2004/09/21 12:25:39 leo Exp $
=head1 NAME
@@ -16,7 +16,7 @@
=cut
-use Parrot::Test tests => 7;
+use Parrot::Test tests => 8;
use Test::More;
# PASM1 is like PASM but appends an C<end> opcode
@@ -168,3 +168,37 @@
ok
OUTPUT
+output_is(<<'CODE', <<'OUTPUT', "bug #31467");
+##PIR##
+ .sub main @MAIN
+ $P1 = new PerlHash
+ newsub $P0, .Sub, _builtin
+ $P1['builtin'] = $P0
+
+ $P2 = compreg "PIR"
+ $S0 = ".sub main\nprint \"dynamic\\n\"\nend\n.end"
+ $P0 = compile $P2, $S0
+ $P1['dynamic'] = $P0
+
+ store_global "funcs", $P1
+
+ $S0 = ".sub main\n$P1 = find_global\"funcs\"\n"
+ $S0 .= "$P0 = $P1['dynamic']\n$P0()\n"
+ $S0 .= "$P0 = $P1['builtin']\n$P0()\n"
+ $S0 .= "end\n.end"
+
+ $P2 = compreg "PIR"
+ $P0 = compile $P2, $S0
+ $P0()
+ end
+ .end
+
+ .sub _builtin
+ print "builtin\n"
+ .pcc_begin_return
+ .pcc_end_return
+ .end
+CODE
+dynamic
+builtin
+OUTPUT