Skip to content

Commit

Permalink
Couple of fixes that get us passing the multi-method/.* interaction t…
Browse files Browse the repository at this point in the history
…ests again. We also manage to win a couple of unexpected passing TODOs.
  • Loading branch information
jnthn committed Oct 27, 2009
1 parent d1dbec7 commit 61c54ef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/classes/Object.pir
Expand Up @@ -758,14 +758,18 @@ methods.
methods = $P0.'can'(self, method_name)
unless methods goto it_loop_end
have_methods:

# Call each method, expanding out any multis along the way.
.local pmc pos_res, named_res, cap, it, multi_it, cur_meth
it = iter methods
it_loop:
unless it goto it_loop_end
cur_meth = shift it
$I0 = isa cur_meth, 'Perl6MultiSub'
$P0 = cur_meth
$I0 = isa $P0, 'P6Invocation'
unless $I0 goto did_deref
$P0 = deref cur_meth
did_deref:
$I0 = isa $P0, 'Perl6MultiSub'
if $I0 goto is_multi
push_eh check_error
(pos_res :slurpy, named_res :named :slurpy) = cur_meth(self, pos_args :flat, named_args :named :flat)
Expand All @@ -774,7 +778,7 @@ methods.
push result_list, cap
goto it_loop
is_multi:
$P0 = cur_meth.'find_possible_candidates'(self, pos_args :flat, named_args :named :flat)
$P0 = $P0.'find_possible_candidates'(self, pos_args :flat, named_args :named :flat)
multi_it = iter $P0
multi_it_loop:
unless multi_it goto it_loop
Expand Down
12 changes: 9 additions & 3 deletions src/pmc/p6invocation.pmc
Expand Up @@ -198,6 +198,7 @@ pmclass P6Invocation need_ext dynpmc group perl6_group {
return 1;

/* If not, then we see if the dispatcher can potentially find more. */
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), NULL);
return !PMC_IS_NULL(get_next_candidate(interp, SELF, P6I_MODE_CHECK, NULL));
}

Expand All @@ -209,8 +210,10 @@ pmclass P6Invocation need_ext dynpmc group perl6_group {
PMC *first_candidate;
PMC *clone = VTABLE_clone(interp, SELF);
GETATTR_P6Invocation_first_candidate(interp, clone, first_candidate);
if (PMC_IS_NULL(first_candidate))
if (PMC_IS_NULL(first_candidate)) {
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), NULL);
first_candidate = get_next_candidate(interp, clone, P6I_MODE_CHECK, NULL);
}
return first_candidate;
}

Expand Down Expand Up @@ -264,10 +267,13 @@ pmclass P6Invocation need_ext dynpmc group perl6_group {
/* Now shuffle along one candidate. */
PMC *first_candidate;
GETATTR_P6Invocation_first_candidate(interp, SELF, first_candidate);
if (PMC_IS_NULL(first_candidate))
if (PMC_IS_NULL(first_candidate)) {
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), NULL);
get_next_candidate(interp, SELF, P6I_MODE_DISPATCH, NULL);
else
}
else {
SETATTR_P6Invocation_first_candidate(interp, SELF, PMCNULL);
}

return result;
}
Expand Down

0 comments on commit 61c54ef

Please sign in to comment.