Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Tweaks to error messages, and a better error for return outside of su…
…broutine.
  • Loading branch information
jnthn committed May 15, 2009
1 parent b7e9b77 commit ee6739d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions perl6.pir
Expand Up @@ -227,11 +227,20 @@ and report exceptions.

# Show the exception message.
$S0 = exception
if $S0 == "" goto no_message
print $S0
$I0 = index $S0, "\n"
if $I0 > 0 goto nl_done
if $I0 > 0 goto message_done
say ""
nl_done:
goto message_done
no_message:
$I0 = exception['type']
if $I0 == .CONTROL_RETURN goto uncaught_return
say "Died"
goto message_done
uncaught_return:
say "Can't return outside a routine"
message_done:

# Now we'll go back, printing one line/file per routine.
.local pmc cur_sub
Expand Down Expand Up @@ -303,13 +312,14 @@ and report exceptions.
concat $S0, ":"
$S1 = anno['line']
if $S1 != "" goto have_line
if $S0 == "(<unknown>:" goto unknown
$S1 = "<unknown>"
have_line:
concat $S0, $S1
concat $S0, ")"
.return ($S0)
unknown:
.return ('unknown location')
.return ("")
.end


Expand Down

0 comments on commit ee6739d

Please sign in to comment.