diff --git a/src/pmc/p6invocation.pmc b/src/pmc/p6invocation.pmc index 7d1de9cee0c..9919d729961 100644 --- a/src/pmc/p6invocation.pmc +++ b/src/pmc/p6invocation.pmc @@ -92,6 +92,16 @@ pmclass P6Invocation need_ext dynpmc group perl6_group { SETATTR_P6Invocation_position(interp, copy, position); return copy; } + + VTABLE INTVAL get_bool() { + PMC *candidates; + INTVAL position; + + /* Get candidates and position, and check if we have more candidates. */ + GETATTR_P6Invocation_candidate_list(interp, SELF, candidates); + GETATTR_P6Invocation_position(interp, SELF, position); + return position < VTABLE_elements(interp, candidates); + } VTABLE opcode_t *invoke(void *next) { STRING *lexname = CONST_STRING(interp, "__CANDIATE_LIST__"); @@ -115,14 +125,8 @@ pmclass P6Invocation need_ext dynpmc group perl6_group { return addr; } - METHOD INTVAL have_more_candidates() { - PMC *candidates; - INTVAL position, result; - - /* Get candidates and position, and check if we have more candidates. */ - GETATTR_P6Invocation_candidate_list(interp, SELF, candidates); - GETATTR_P6Invocation_position(interp, SELF, position); - result = position < VTABLE_elements(interp, candidates); - RETURN(INTVAL result); + METHOD PMC *get() { + PMC *next = get_next_candidate(interp, SELF); + RETURN(PMC *next); } } diff --git a/t/pmc/p6invocation-1.t b/t/pmc/p6invocation-1.t index 7106b814ae4..bd2733cc56f 100644 --- a/t/pmc/p6invocation-1.t +++ b/t/pmc/p6invocation-1.t @@ -46,7 +46,7 @@ Test the P6Invocation PMC. ok_3: say "ok 3" - $I0 = $P0.'have_more_candidates'() + $I0 = istrue $P0 if $I0 != 0 goto ok_4 print "not" ok_4: @@ -59,7 +59,7 @@ Test the P6Invocation PMC. .lex '__CANDIATE_LIST__', $P0 say "ok 5" - $I0 = $P0.'have_more_candidates'() + $I0 = istrue $P0 if $I0 != 0 goto ok_6 print "not" ok_6: @@ -72,7 +72,7 @@ Test the P6Invocation PMC. .lex '__CANDIATE_LIST__', $P0 say "ok 7" - $I0 = $P0.'have_more_candidates'() + $I0 = istrue $P0 if $I0 == 0 goto ok_8 print "not" ok_8: