Skip to content

Commit

Permalink
A couple of minor fixes to get wrappers working a bit better. Wins us…
Browse files Browse the repository at this point in the history
… +20 tests we never passed before in wrap.t.
  • Loading branch information
jnthn committed May 12, 2009
1 parent feca3f2 commit b6c0eaf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/builtins/control.pir
Expand Up @@ -443,8 +443,12 @@ on error.
.local pmc clist, lexpad, self, next
get_next_candidate_info clist, $P0, lexpad
next = clist.'get'()
$I0 = isa next, 'Method'
unless $I0 goto not_method
self = lexpad['self']
.tailcall next(self, pos_args :flat, named_args :flat :named)
not_method:
.tailcall next(pos_args :flat, named_args :flat :named)
.end


Expand All @@ -461,9 +465,14 @@ on error.
.local pmc clist, lexpad, self, next, result
get_next_candidate_info clist, $P0, lexpad
next = clist.'get'()
$I0 = isa next, 'Method'
unless $I0 goto not_method
self = lexpad['self']
(result) = next(self, pos_args :flat, named_args :flat :named)
'return'(result)
not_method:
(result) = next(pos_args :flat, named_args :flat :named)
'return'(result)
.end


Expand Down
19 changes: 18 additions & 1 deletion src/classes/Routine.pir
Expand Up @@ -112,11 +112,28 @@ wrappable executable objects.
.sub '!wrap_clholder_helper' :anon
.param pmc pos_args :slurpy
.param pmc named_args :slurpy :named

# Slot for candidate list.
.lex '__CANDIDATE_LIST__', $P0

# Set up return handler, so next[with|same] work.
$P2 = new 'ExceptionHandler'
set_addr $P2, ret_handler
$P2."handle_types"(58)
push_eh $P2

# Get the inner block and call it.
$P1 = interpinfo .INTERPINFO_CURRENT_SUB
$P1 = getprop '$!wrapper_block', $P1
capture_lex $P1
.tailcall $P1(pos_args :flat, named_args :flat :named)
($P3) = $P1(pos_args :flat, named_args :flat :named)
.return ($P3)

ret_handler:
.local pmc exception, result
.get_results (exception)
result = getattribute exception, "payload"
.return (result)
.end


Expand Down

0 comments on commit b6c0eaf

Please sign in to comment.