Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Do not let control exceptions slip through. Also adds a handle-contro…
…l hook.
  • Loading branch information
mlschroe committed Oct 13, 2011
1 parent 05affcf commit 15be997
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/HLL/Compiler.pm
Expand Up @@ -327,6 +327,22 @@ class HLL::Compiler {
$has_error := 1;
$error := $_;
}
CONTROL {
if pir::can(self, 'handle-control') {
self.handle-control($_);
} elsif pir::islt__IIi(pir::getattribute__PPs($_, 'severity'), pir::const::EXCEPT_ERROR) {
my $err := pir::getstderr__P();
my $message := ~$_;
$err.print($message ?? $message !! "Warning");
$err.print("\n");
my $resume := pir::getattribute__PPs($_, 'resume');
if ($resume) {
$resume();
}
}
$has_error := 1;
$error := $_;
}
}
if ($has_error) {
if %adverbs<ll-exception> || !pir::can(self, 'handle-exception') {
Expand Down

0 comments on commit 15be997

Please sign in to comment.