Ticket #389: 389.patch

File 389.patch, 1.6 KB (added by bacek, 5 years ago)

Proposed fix for ticket.

  • compilers/imcc/pbc.c

    commit 88efcb49c8017dad00b17a535ec545206ca47eca
    Author: Vasily Chekalkin <bacek@bacek.com>
    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 b  
    14821482        } 
    14831483        else 
    14841484            sub->method_name = sub->name; 
     1485        sub_pmc->flags |= SUB_FLAG_PF_ANON; 
    14851486    } 
    14861487    else 
    14871488        sub->method_name = Parrot_str_new(interp, "", 0); 
  • src/global.c

    diff --git a/src/global.c b/src/global.c
    index c32c2b5..13c62de 100644
    a b  
    549549         */ 
    550550        res = (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname); 
    551551    } 
     552     
     553    if (PMC_IS_NULL(res)) 
     554        return NULL; 
    552555 
    553     return PMC_IS_NULL(res) ? NULL : res; 
     556    if (PObj_get_FLAGS(res) & SUB_FLAG_PF_ANON) 
     557        return NULL; 
     558 
     559    return res; 
    554560} 
    555561 
    556562/* 
     
    878884    if (!PMC_IS_NULL(sub->multi_signature)) 
    879885        store_sub_in_multi(interp, sub_pmc, ns); 
    880886 
    881     /* store other subs (as long as they're not :anon) */ 
    882     else if (!(PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_ANON)) { 
     887    /* store other subs */ 
     888    else { 
    883889        STRING * const ns_entry_name = sub->ns_entry_name; 
    884890        PMC    * const nsname        = sub->namespace_name; 
    885891