diff --git a/src/builtins/control.pir b/src/builtins/control.pir index cc013e97bf2..43b83ea0af8 100644 --- a/src/builtins/control.pir +++ b/src/builtins/control.pir @@ -444,7 +444,8 @@ on error. .local pmc clist, lexpad, self, next get_next_candidate_info clist, $P0, lexpad next = clist.'get'() - $I0 = isa next, 'Method' + $P0 = deref next + $I0 = isa $P0, 'Method' unless $I0 goto not_method self = lexpad['self'] .tailcall next(self, pos_args :flat, named_args :flat :named) @@ -466,7 +467,8 @@ on error. .local pmc clist, lexpad, self, next, result get_next_candidate_info clist, $P0, lexpad next = clist.'get'() - $I0 = isa next, 'Method' + $P0 = deref next + $I0 = isa $P0, 'Method' unless $I0 goto not_method self = lexpad['self'] (result) = next(self, pos_args :flat, named_args :flat :named) diff --git a/src/pmc/p6invocation.pmc b/src/pmc/p6invocation.pmc index 88ac9311d40..82c956a870e 100644 --- a/src/pmc/p6invocation.pmc +++ b/src/pmc/p6invocation.pmc @@ -170,6 +170,15 @@ pmclass P6Invocation need_ext dynpmc group perl6_group { GETATTR_P6Invocation_position(interp, SELF, position); return position < VTABLE_elements(interp, candidates); } + + VTABLE PMC *get_pmc() { + PMC *first_candidate; + PMC *clone = VTABLE_clone(interp, SELF); + GETATTR_P6Invocation_first_candidate(interp, clone, first_candidate); + if (PMC_IS_NULL(first_candidate)) + first_candidate = get_next_candidate(interp, clone); + return first_candidate; + } VTABLE opcode_t *invoke(void *next) { STRING *lexname = CONST_STRING(interp, "__CANDIDATE_LIST__");