diff --git a/src/global.c b/src/global.c index 29b9b30..fe4bf75 100644 --- a/src/global.c +++ b/src/global.c @@ -609,8 +609,9 @@ Parrot_store_sub_in_namespace(PARROT_INTERP, NOTNULL(PMC *sub)) /* store a :multi sub */ if (!PMC_IS_NULL(PMC_sub(sub)->multi_signature)) store_sub_in_multi(interp, sub, ns); - /* store other subs (as long as they're not :anon) */ - else if (!(PObj_get_FLAGS(sub) & SUB_FLAG_PF_ANON)) { + /* store other subs (as long as they're not :anon, but the namespace will + * detect that) */ + else { STRING * const name = PMC_sub(sub)->name; PMC * const nsname = PMC_sub(sub)->namespace_name; diff --git a/t/compilers/imcc/syn/sub.t b/t/compilers/imcc/syn/sub.t new file mode 100644 index 0000000..91bc06e --- /dev/null +++ b/t/compilers/imcc/syn/sub.t @@ -0,0 +1,36 @@ +#!perl +# Copyright (C) 2005, The Perl Foundation. +# $Id$ + +use strict; +use warnings; +use lib qw( . lib ../lib ../../lib ); +use Parrot::Test tests => 1; + +############################## + +pir_output_is( <<'CODE', <<'OUTPUT', ":anon :vtable should work" ); +.sub main :main + $P0 = newclass "Foo" + $P0 = new "Foo" + $I0 = $P0 + $S0 = $I0 + say $S0 +.end + +.namespace ["Foo"] + +.sub get_integer :vtable :anon + .return (42) +.end +CODE +42 +OUTPUT + + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: