Created
January 25, 2012 19:07
-
-
Save moritz/1677947 to your computer and use it in GitHub Desktop.
Exception patch gone wrong
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Perl6/Grammar.pm b/src/Perl6/Grammar.pm | |
index d64b960..d98fb25 100644 | |
--- a/src/Perl6/Grammar.pm | |
+++ b/src/Perl6/Grammar.pm | |
@@ -39,9 +39,18 @@ grammar Perl6::Grammar is HLL::Grammar { | |
$cursor; | |
} | |
+ method typed_panic($type_str, *%opts) { | |
+ $*W.throw(self.MATCH(), nqp::split('::', $type_str), |%opts); | |
+ } | |
+ | |
# "when" arg assumes more things will become obsolete after Perl 6 comes out... | |
method obs ($old, $new, $when = ' in Perl 6') { | |
- self.panic("Unsupported use of $old;$when please use $new"); | |
+ my $str := $*W.find_symbol(['Str']); | |
+ $*W.throw(self.MATCH(), ['X', 'Obsolete'], | |
+ old => nqp::box_s($old, $str), | |
+ new => nqp::box_s($new, $str), | |
+ when => nqp::box_s($when, $str), | |
+ ); | |
} | |
## Lexer stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./perl6 --ll-exception -e 'for (1; 1; 1) { }' | |
Cannot look up attributes in a type object | |
current instr.: 'new' pc 865737 (src/gen/CORE.setting.pir:224620) (src/gen/CORE.setting:1384) | |
called from Sub 'nqp;Perl6;World;_block2254' pc 35816 (src/gen/perl6-symboltable.pir:14678) (src/Perl6/World.pm:1882) | |
called from Sub 'nqp;Perl6;World;throw' pc 35173 (src/gen/perl6-symboltable.pir:14389) (src/Perl6/World.pm:1872) | |
called from Sub 'nqp;Perl6;Grammar;obs' pc 32076 (src/gen/perl6-grammar.pir:8113) (src/Perl6/Grammar.pm:49) | |
called from Sub 'nqp;Perl6;Grammar;statement_control:sym<for>' pc 80713 (src/gen/perl6-grammar.pir:23332) (src/Perl6/Grammar.pm:637) | |
called from Sub 'nqp;Regex;Cursor;!protoregex' pc 4018 (src/Regex/Cursor.pir:81) | |
called from Sub 'nqp;Perl6;Grammar;statement_control' pc 76537 (src/gen/perl6-grammar.pir:22302) (src/Perl6/Grammar.pm:604) | |
called from Sub 'nqp;Perl6;Grammar;statement' pc 68084 (src/gen/perl6-grammar.pir:19484) (src/Perl6/Grammar.pm:519) | |
called from Sub 'nqp;Perl6;Grammar;statementlist' pc 66994 (src/gen/perl6-grammar.pir:19187) (src/Perl6/Grammar.pm:506) | |
called from Sub 'nqp;Perl6;Grammar;comp_unit' pc 64656 (src/gen/perl6-grammar.pir:18245) (src/Perl6/Grammar.pm:476) | |
called from Sub 'nqp;Perl6;Grammar;TOP' pc 31718 (src/gen/perl6-grammar.pir:7952) (src/Perl6/Grammar.pm:36) | |
called from Sub 'nqp;Regex;Cursor;parse' pc 1781 (src/Regex/Cursor.pir:470) | |
called from Sub 'nqp;HLL;Compiler;parse' pc 37890 (src/stage2/gen/NQPHLL.pir:13746) (src/stage2/gen/NQPHLL.pm:1496) | |
called from Sub 'nqp;HLL;Compiler;_block2033' pc 37392 (src/stage2/gen/NQPHLL.pir:13517) (src/stage2/gen/NQPHLL.pm:1472) | |
called from Sub 'nqp;HLL;Compiler;compile' pc 37259 (src/stage2/gen/NQPHLL.pir:13446) (src/stage2/gen/NQPHLL.pm:1470) | |
called from Sub 'nqp;HLL;Compiler;eval' pc 33574 (src/stage2/gen/NQPHLL.pir:11635) (src/stage2/gen/NQPHLL.pm:1256) | |
called from Sub 'nqp;HLL;Compiler;_block1864' pc 35540 (src/stage2/gen/NQPHLL.pir:12596) (src/stage2/gen/NQPHLL.pm:1386) | |
called from Sub 'nqp;HLL;Compiler;command_eval' pc 34969 (src/stage2/gen/NQPHLL.pir:12356) (src/stage2/gen/NQPHLL.pm:1401) | |
called from Sub 'nqp;Perl6;Compiler;command_eval' pc 974 (src/gen/perl6-compiler.pir:377) (src/Perl6/Compiler.nqp:18) | |
called from Sub 'nqp;HLL;Compiler;command_line' pc 34633 (src/stage2/gen/NQPHLL.pir:12198) (src/stage2/gen/NQPHLL.pm:1353) | |
called from Sub 'MAIN' pc 753 (src/gen/perl6.pir:287) (src/main.nqp src/gen/main-version.nqp:32) | |
called from Sub '_block1000' pc 100 (src/gen/perl6.pir:71) (src/main.nqp src/gen/main-version.nqp:1) | |
About the bactrace: | |
'new' pc 865737 (src/gen/CORE.setting.pir:224620) (src/gen/CORE.setting:1384) | |
is the accessors | |
called from Sub 'nqp;Perl6;World;_block2254' pc 35816 (src/gen/perl6-symboltable.pir:14678) (src/Perl6/World.pm:1882) | |
%opts<filename> := nqp::box_s( | |
pir::isnull($file) ?? '<unknown file>' !! $file, | |
self.find_symbol(['Str']) | |
); | |
$ex.new(|%opts).throw; # that's the line that dies | |
} else { | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment