In rev 10317, parrot segfaults if the sub named in ":outer" is not
defined in the current compilation unit. The patch fixes the symptom,
and adds a test. (But the error message could be improved.)
-- Bob Rogers
http://rgrjr.dyndns.org/
Index: imcc/pbc.c
===================================================================
--- imcc/pbc.c (revision 10317)
+++ imcc/pbc.c (working copy)
@@ -594,6 +594,10 @@
* could be eval too - look, if :outer is the currentsub
*/
current = CONTEXT(interpreter->ctx)->current_sub;
+ if (! current)
+ IMCC_fatal(interpreter, 1,
+ "Undefined :outer sub '%s'.\n",
+ unit->outer->name);
cur_name = PMC_sub(current)->name;
if (cur_name->strlen == len &&
!memcmp((char*)cur_name->strstart, unit->outer->name, len)) {
Index: t/op/lexicals.t
===================================================================
--- t/op/lexicals.t (revision 10317)
+++ t/op/lexicals.t (working copy)
@@ -328,6 +328,16 @@
ok
OUTPUT
+pir_output_is(<<'CODE', <<'OUTPUT', ':outer parsing - missing :outer');
+.sub main
+ print "ok\n"
+.end
+.sub foo :outer(oops)
+.end
+CODE
+Undefined :outer sub 'oops'.
+OUTPUT
+
pir_output_is(<<'CODE', <<'OUTPUT', 'get_lexinfo from pad');
.sub main
.lex '$a', P0
@@ -866,4 +876,4 @@
## remember to change the number of tests :-)
-BEGIN { plan tests => 35; }
+BEGIN { plan tests => 36; }