commit 88efcb49c8017dad00b17a535ec545206ca47eca Author: Vasily Chekalkin Date: Mon May 25 01:46:41 2009 +1000 [core] Store anonimous subs in namespace and filter them out in find_globa. This allows class.pmc to find them, but no one else will do. diff --git a/compilers/imcc/pbc.c b/compilers/imcc/pbc.c index 098f27c..c30174c 100644 --- a/compilers/imcc/pbc.c +++ b/compilers/imcc/pbc.c @@ -1482,6 +1482,7 @@ add_const_pmc_sub(PARROT_INTERP, ARGMOD(SymReg *r), size_t offs, size_t end) } else sub->method_name = sub->name; + sub_pmc->flags |= SUB_FLAG_PF_ANON; } else sub->method_name = Parrot_str_new(interp, "", 0); diff --git a/src/global.c b/src/global.c index c32c2b5..13c62de 100644 --- a/src/global.c +++ b/src/global.c @@ -549,8 +549,14 @@ Parrot_find_global_n(PARROT_INTERP, ARGIN_NULLOK(PMC *ns), ARGIN_NULLOK(STRING * */ res = (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname); } + + if (PMC_IS_NULL(res)) + return NULL; - return PMC_IS_NULL(res) ? NULL : res; + if (PObj_get_FLAGS(res) & SUB_FLAG_PF_ANON) + return NULL; + + return res; } /* @@ -878,8 +884,8 @@ Parrot_store_sub_in_namespace(PARROT_INTERP, ARGIN(PMC *sub_pmc)) if (!PMC_IS_NULL(sub->multi_signature)) store_sub_in_multi(interp, sub_pmc, ns); - /* store other subs (as long as they're not :anon) */ - else if (!(PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_ANON)) { + /* store other subs */ + else { STRING * const ns_entry_name = sub->ns_entry_name; PMC * const nsname = sub->namespace_name;