Skip to content

Commit

Permalink
Add &warn
Browse files Browse the repository at this point in the history
  • Loading branch information
tene committed Jan 6, 2010
1 parent 93fa57e commit 3f06c7e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/builtins/control.pir
Expand Up @@ -20,7 +20,7 @@ src/builtins/control.pir - control flow related functions
.local string message
.local pmc p6ex
.local pmc ex

message = join '', list
if message > '' goto have_message
message = "Died\n"
Expand All @@ -36,6 +36,27 @@ src/builtins/control.pir - control flow related functions
.return ()
.end

.sub '&warn'
.param pmc list :slurpy
.local string message
.local pmc p6ex
.local pmc ex

message = join '', list
if message > '' goto have_message
message = "Warning\n"
have_message:
p6ex = new ['Perl6Exception']
ex = root_new ['parrot';'Exception']
ex = message
ex['severity'] = .EXCEPT_WARNING
ex['type'] = .CONTROL_ERROR
setattribute p6ex, '$!exception', ex
set_global '$!', p6ex
throw ex
.return ()
.end

=item fail

=cut
Expand Down

0 comments on commit 3f06c7e

Please sign in to comment.