Browse files

Avoid internal error with my $.foo at top level (fixes #126)

  • Loading branch information...
1 parent 026b805 commit 9615535a121e1fac787170d5ed62a6ec7fc7ebd2 @sorear committed May 25, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/NieczaActions.pm6
View
4 src/NieczaActions.pm6
@@ -2825,6 +2825,10 @@ method multi_declarator:only ($/) { make ($<declarator> // $<routine_def>).ast}
method add_accessor($/, $name, $store_name, $lexical, $public) {
my $ns = $*CURLEX<!sub>.body_of;
+ if !$ns || !$ns.CAN('add_method') {
+ $/.CURSOR.sorry("Cannot add accessors to a non-class");
+ return;
+ }
my $nb = $*unit.create_sub(
outer => $*CURLEX<!sub>,
name => $name,

0 comments on commit 9615535

Please sign in to comment.