#1492: Get_class <namespace> confuses NSes that have same final name.
-----------------------------+----------------------------------------------
Reporter: Austin_Hastings | Owner: whiteknight
Type: bug | Status: new
Priority: normal | Milestone:
Component: core | Version: 2.1.0
Severity: high | Keywords: namespace, class, get_class
Lang: | Patch:
Platform: |
-----------------------------+----------------------------------------------
Comment(by whiteknight):
Next piece of the puzzle. In src/oo.c:Parrot_oo_get_class, when we call it
with the NSP namespace PMC from my example above, we hit this piece of
code:
{{{
switch (key->vtable->base_type) {
case enum_class_NameSpace:
classobj = VTABLE_get_class(interp, key);
break;
}}}
However, at this point there is no NSP class object, VTABLE_get_class
returns PMCNULL, and we enter a branch further down in the function that
is intended to handle lazy creation of a PMCProxy. Here's the codepath it
takes:
{{{
type = Parrot_pmc_get_type_str(interp, VTABLE_get_string(interp, key));
classobj = get_pmc_proxy(interp, type);
}}}
...And when stringified, the namespace apparently is just "P".
get_pmc_proxy, despite the name, doesn't get a PMCProxy for the type if a
class is already defined for it. Instead, it returns the "P" class object,
which is where Austin's code got lost.
I think the problem is calling get_class to lookup a Class object that
doesn't exist yet. In this case, I think we should return PMCNULL from
get_class until newclass is created. I'm going to hack that solution
together now, test it, and commit it if things look good.
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/1492#comment:2>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets