Skip to content

Commit

Permalink
Make "is rw" on parameters of MAIN worry (#3947)
Browse files Browse the repository at this point in the history
As noted in R#3929 by Zoffix++
  • Loading branch information
lizmat committed Oct 14, 2020
1 parent 4af961e commit d0854ff
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Perl6/Actions.nqp
Expand Up @@ -4025,9 +4025,18 @@ class Perl6::Actions is HLL::Actions does STDActions {
));
}

# Set name.
# Set name if we have one
if $<deflongname> {
$block.name(~$<deflongname>.ast);
my $name := ~$<deflongname>.ast;
$block.name($name);

# Check for 'is rw' parameters if MAIN
if $name eq 'MAIN' {
for $signature.params.FLATTENABLE_LIST -> $param {
$/.worry("'is rw' on parameters of 'sub MAIN' usually cannot be satisfied.\nDid you mean 'is copy'?")
if $param.rw;
}
}
}

# Finish code object, associating it with the routine body.
Expand Down

0 comments on commit d0854ff

Please sign in to comment.