From 464fb9f25e56bde5cd4f6aeb0c1a82376c89cd4c Mon Sep 17 00:00:00 2001 From: jnthn Date: Sat, 1 Oct 2011 18:13:51 +0200 Subject: [PATCH] Complain about declaration of placeholders in the mainline. --- src/Perl6/Actions.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm index 5d2261838c4..03e8de8734e 100644 --- a/src/Perl6/Actions.pm +++ b/src/Perl6/Actions.pm @@ -3551,8 +3551,14 @@ class Perl6::Actions is HLL::Actions { # Adds a placeholder parameter to this block's signature. sub add_placeholder_parameter($/, $sigil, $ident, :$named, :$pos_slurpy, :$named_slurpy) { - # Obtain/create placeholder parameter list. + # Ensure we're not trying to put a placeholder in the mainline. my $block := $*ST.cur_lexpad(); + if $block eq 'mainline' { + $/.CURSOR.panic("Cannot declare placeholder parameter $sigil" ~ + ($named ?? ':' !! '^') ~ "$ident in the mainline"); + } + + # Obtain/create placeholder parameter list. my @params := $block || ($block := []); # If we already declared this as a placeholder, we're done.