Ticket #1542: ns_abduction.patch

File ns_abduction.patch, 0.7 KB (added by plobsing, 4 years ago)

Only adopt Namespaces without parents.

  • src/pmc/namespace.pmc

     
    468468        if (val_is_NS) { 
    469469            /* TODO - this hack needs to go */ 
    470470            Parrot_NameSpace_attributes *nsinfo = PARROT_NAMESPACE(value); 
    471             nsinfo->parent = SELF;  /* set parent */ 
    472             nsinfo->name   = key;   /* and name */ 
     471            if (PMC_IS_NULL(nsinfo->parent)) { 
     472                nsinfo->parent = SELF;  /* set parent */ 
     473                nsinfo->name   = key;   /* and name */ 
     474            } 
    473475 
    474476            if (new_tuple) { 
    475477                VTABLE_set_pmc_keyed_int(INTERP, new_tuple, NS_slot_ns, value);