Skip to content
Permalink
Browse files

Use the first placeholder AST to report placeholder method errors

It would be nice to point to the first placeholder variable in use
when reporting an error with a placeholder, in order to give the user
more precise context
  • Loading branch information...
hoelzro committed Oct 23, 2018
1 parent 0896c30 commit 48093d0dd9a86b44c8c630849fe701066f6e3a54
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/Perl6/Actions.nqp
@@ -4286,9 +4286,10 @@ class Perl6::Actions is HLL::Actions does STDActions {

my $non-placeholder-names := nqp::join(', ', @non-placeholder-names);

my $first-placeholder-name := $past.ann('placeholder_sig')[0]<placeholder>;
my $first-placeholder := $past.ann('placeholder_sig')[0];
my $first-placeholder-name := $first-placeholder<placeholder>;

$/.PRECURSOR.panic("Placeholder variables (eg. $first-placeholder-name) cannot be used in a method.\nPlease specify an explicit signature, like $*METHODTYPE $method-name ($non-placeholder-names) \{ ... \}");
$first-placeholder<ast>.PRECURSOR.panic("Placeholder variables (eg. $first-placeholder-name) cannot be used in a method.\nPlease specify an explicit signature, like $*METHODTYPE $method-name ($non-placeholder-names) \{ ... \}");
}
if is_clearly_returnless($past) {
$past[1] := QAST::Op.new(

0 comments on commit 48093d0

Please sign in to comment.
You can’t perform that action at this time.