Skip to content

Commit

Permalink
Avoid internal error with my $.foo at top level (fixes #126)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed May 25, 2012
1 parent 026b805 commit 9615535
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/NieczaActions.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9615535

Please sign in to comment.