Author: pmichaud
Date: Thu Jan 25 19:34:43 2007
New Revision: 16802

Modified:
   trunk/src/pmc/sub.pmc
   trunk/t/pmc/sub.t

Log:
[core]:
Revise Sub PMC's assign_pmc vtable function to work with subs
having :outer(...) pragma.


Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc       (original)
+++ trunk/src/pmc/sub.pmc       Thu Jan 25 19:34:43 2007
@@ -364,8 +364,8 @@
     }
 
     void assign_pmc(PMC* other) {
-        /* only handle the case where the other PMC is a Sub */
-        if (other->vtable->base_type == enum_class_Sub) {
+        /* only handle the case where the other PMC is the same type */
+        if (other->vtable->base_type == SELF->vtable->base_type) {
             /* copy the sub struct */
             memcpy(PMC_sub(SELF), PMC_sub(other), sizeof (struct Parrot_sub));
             /* copy the name so it's a different string in memory */

Modified: trunk/t/pmc/sub.t
==============================================================================
--- trunk/t/pmc/sub.t   (original)
+++ trunk/t/pmc/sub.t   Thu Jan 25 19:34:43 2007
@@ -7,7 +7,7 @@
 use lib qw( . lib ../lib ../../lib );
 
 use Test::More;
-use Parrot::Test tests => 59;
+use Parrot::Test tests => 60;
 use Parrot::Config;
 
 =head1 NAME
@@ -1336,6 +1336,24 @@
 ok
 OUTPUT
 
+pir_output_is(<<'CODE', <<'OUTPUT', 'assign w/:outer');
+.sub main :main
+    $P0 = get_global 'ok'
+
+    $P1 = new .Undef
+    assign $P1, $P0
+
+    $P1()
+.end
+
+.sub ok :outer('main')
+    say "ok"
+.end
+CODE
+ok
+OUTPUT
+
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Reply via email to