Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Disallow redeclaring constants in the same scope
  • Loading branch information
perlpilot committed Feb 26, 2015
1 parent 3607d7b commit a15a916
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Perl6/Actions.nqp
Expand Up @@ -3541,8 +3541,13 @@ class Perl6::Actions is HLL::Actions does STDActions {
}

if $name {
my $cur_pad := $*W.cur_lexpad();
if $cur_pad.symbol($name) {
$*W.throw($/, ['X', 'Redeclaration'], symbol => $name);
}

$*W.install_package($/, [$name], ($*SCOPE || 'our'),
'constant', $*PACKAGE, $*W.cur_lexpad(), $value);
'constant', $*PACKAGE, $cur_pad, $value);
}
$*W.ex-handle($/, {
for $<trait> -> $t {
Expand Down

0 comments on commit a15a916

Please sign in to comment.