Skip to content

Instantly share code, notes, and snippets.

Created March 23, 2015 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/27da128ae72198ceb182 to your computer and use it in GitHub Desktop.
Save anonymous/27da128ae72198ceb182 to your computer and use it in GitHub Desktop.
Distinguishable yada exceptions
Stage parse : Could not locate compile-time value for symbol X::Stub::Executed
at src/Perl6/World.nqp:2657 (blib/Perl6/World.moarvm:find_symbol:260)
from src/gen/m-Perl6-Actions.nqp:4208 (blib/Perl6/Actions.moarvm:make_yada:81)
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index c472c56..4011acd 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -4206,7 +4206,8 @@ class Perl6::Actions is HLL::Actions does STDActions {
$past.name($name);
$past.node($/);
unless +$past.list() {
- $past.push($*W.add_string_constant('Stub code executed'));
+ $past.push(QAST::Op.new(:op<callmethod>, :name<new>,
+ QAST::WVal.new( :value($*W.find_symbol(['X::Stub::Executed'])) )));
}
$past
}
diff --git a/src/core/Exception.pm b/src/core/Exception.pm
index 619e34f..e204b87 100644
--- a/src/core/Exception.pm
+++ b/src/core/Exception.pm
@@ -1203,6 +1203,10 @@ my class X::Package::Stubbed does X::Comp {
}
}
+my class X::Stub::Executed is Exception {
+ method message { 'Stub code executed' }
+}
+
my class X::Phaser::PrePost is Exception {
has $.phaser = 'PRE';
has $.condition;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment