Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
A very first-cut implementation of lastcall, which just trims the can…
…didate list such that nextsame and friends will find nothing else to defer to.
  • Loading branch information
jnthn committed Aug 14, 2009
1 parent 62f6082 commit bae2cfa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/builtins/control.pir
Expand Up @@ -517,6 +517,21 @@ on error.
.end


=item lastcall

Trims the candidate list so that nextsame/nextwith/callsame/callwith will
find nothing more to call.

=cut

.sub 'lastcall'
# Find candidate list and trim it.
.local pmc clist
get_next_candidate_info clist, $P0, $P1
clist.'trim_candidate_list'()
.end


=item !get_original_args

Helper for callsame and nextsame that uses the signature and lexpad of a
Expand Down
10 changes: 10 additions & 0 deletions src/pmc/p6invocation.pmc
Expand Up @@ -249,4 +249,14 @@ pmclass P6Invocation need_ext dynpmc group perl6_group {
PMC *result = VTABLE_shift_pmc(interp, SELF);
RETURN(PMC *result);
}

METHOD void trim_candidate_list() {
/* Just blank out everything we could use to find another
* method. */
SETATTR_P6Invocation_candidate_list(interp, SELF, PMCNULL);
SETATTR_P6Invocation_position(interp, SELF, 0);
SETATTR_P6Invocation_name(interp, SELF, NULL);
SETATTR_P6Invocation_search_list(interp, SELF, PMCNULL);
SETATTR_P6Invocation_resume_point(interp, SELF, 0);
}
}

0 comments on commit bae2cfa

Please sign in to comment.