diff --git a/src/parser/actions.pm b/src/parser/actions.pm index 06ce6674c59..4e30f6bd01a 100644 --- a/src/parser/actions.pm +++ b/src/parser/actions.pm @@ -758,10 +758,16 @@ method routine_declarator($/, $key) { method routine_def($/) { - my $block := $.ast; + our $?BLOCK_OPEN; + unless $?BLOCK_OPEN { + $?BLOCK_OPEN := PAST::Block.new( PAST::Stmts.new(), :node($/) ); + } + my $block := $?BLOCK_OPEN; $block.blocktype('declaration'); if $ { my $name := ~$[0]; + my $match := Perl6::Grammar::opname($name, :grammar('Perl6::Grammar') ); + if $match { $name := ~$match ~ ':' ~ ~$match[0]; } our @?BLOCK; my $existing := @?BLOCK[0].symbol($name); if $existing && !$existing && !$existing { diff --git a/src/parser/grammar.pg b/src/parser/grammar.pg index 5ed71f2477e..4ad30076d51 100644 --- a/src/parser/grammar.pg +++ b/src/parser/grammar.pg @@ -418,9 +418,9 @@ rule multisig { } rule routine_def { - [ ]? [ | ]* - + [ ]? [ | ]* {*} + || <.panic: "Malformed routine definition"> }