Skip to content

Commit

Permalink
Merge remote branch 'origin/outer-bound' into nom
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Dec 21, 2012
2 parents f6ee0c9 + 0199241 commit 3c3f780
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Perl6/Actions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1702,8 +1702,14 @@ class Perl6::Actions is HLL::Actions does STDActions {
my $sigil := $<variable><sigil>;
my $twigil := $<variable><twigil>[0];
my $name := ~$sigil ~ ~$twigil ~ ~$<variable><desigilname>;
if $<variable><desigilname> && $*W.cur_lexpad().symbol($name) {
$/.CURSOR.typed_worry('X::Redeclaration', symbol => $name);
if $<variable><desigilname> {
my $lex := $*W.cur_lexpad();
if $lex.symbol($name) {
$/.CURSOR.typed_worry('X::Redeclaration', symbol => $name);
}
elsif $lex<also_uses> && $lex<also_uses>{$name} {
$/.CURSOR.typed_sorry('X::Redeclaration::Outer', symbol => $name);
}
}
make declare_variable($/, $past, ~$sigil, ~$twigil, ~$<variable><desigilname>, $<trait>, $<semilist>);
}
Expand Down
9 changes: 9 additions & 0 deletions src/core/Exception.pm
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,15 @@ my class X::Redeclaration does X::Comp {
}
}

my class X::Redeclaration::Outer does X::Comp {
has $.symbol;
method message() {
"Lexical symbol '$.symbol' is already bound to an outer symbol;\n" ~
"the implicit outer binding must be rewritten as OUTER::<$.symbol>\n" ~
"before you can unambiguously declare a new '$.symbol' in this scope";
}
}

my class X::Import::Redeclaration does X::Comp {
has @.symbols;
has $.source-package-name;
Expand Down

0 comments on commit 3c3f780

Please sign in to comment.