On Wednesday 16 May 2007 21:15:53 Mehmet Yavuz Selim Soyturk wrote:
> The following patch solves that issue.
>
> --- src/pmc/class.pmc (revision 18568)
> +++ src/pmc/class.pmc (working copy)
> @@ -1111,8 +1111,9 @@
> PMC *role = VTABLE_get_pmc_keyed_int(interp, role_list,
> i); (STRING *r_name) = PCCINVOKE(interp, role, "name");
>
> - if (string_compare(interp, role_name, r_name))
> + if (string_compare(interp, role_name, r_name) == 0) {
> PCCRETURN(INTVAL 1);
> + }
> }
>
> PCCRETURN(INTVAL 0);
Sort of, but it also breaks test #15 in t/pmc/class.t. That's not your fault
though; the code fails to take into account role composition into roles. I
keep trying to fix it, but it gets a lot more complex than I thought.
I suspect what needs to happen is that Class#does() ought to loop through all
of the roles composed into the class, check if their names match the given
name, then call does() on each of them in turn.
-- c