Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add support for &fail throwing when $*FATAL is set
  • Loading branch information
tene committed Jan 4, 2010
1 parent c2ba04d commit aebe139
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/builtins/Failure.pir
Expand Up @@ -51,7 +51,7 @@ A Perl 6 Exception object.
$P0 = self.'exception'()
$I0 = $P0.'handled'()
if $I0 goto okay
$P0.'throw'()
.tailcall $P0.'throw'()
okay:
.end

Expand Down
10 changes: 7 additions & 3 deletions src/builtins/control.pir
Expand Up @@ -45,16 +45,20 @@ src/builtins/control.pir - control flow related functions
.sub '&fail'
.param pmc value :optional
.param int has_value :opt_flag
.local pmc ex, p6ex, failure
.local pmc ex, p6ex, failure, fatal

ex = root_new ['parrot';'Exception']
$P0 = get_hll_global 'Exception'
p6ex = $P0.'new'(ex)
unless has_value goto no_value
ex['payload'] = value
$S0 = value
ex['message'] = value
no_value:
fatal = "!find_contextual"("$*FATAL")
unless fatal goto no_fatal
throw ex
no_fatal:
$P0 = get_hll_global 'Exception'
p6ex = $P0.'new'(ex)
$P0 = get_hll_global 'Failure'
failure = $P0.'new'(p6ex)

Expand Down

0 comments on commit aebe139

Please sign in to comment.