Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
forbid scopes on individual multi candidates
  • Loading branch information
moritz committed Mar 15, 2012
1 parent 34b7b10 commit b4caaa4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Perl6/Actions.pm
Expand Up @@ -1666,6 +1666,12 @@ class Perl6::Actions is HLL::Actions {
$proto := $outer.symbol($name)<value>;
}
else {
unless $*SCOPE eq '' || $*SCOPE eq 'my' {
$*W.throw($/, 'X::Declaration::Scope::Multi',
scope => $*SCOPE,
declaration => 'multi',
);
}
# None; search outer scopes.
my $new_proto;
try {
Expand Down
6 changes: 6 additions & 0 deletions src/core/Exception.pm
Expand Up @@ -455,6 +455,12 @@ my class X::Declaration::Scope does X::Comp {
method message() { "Cannot use '$.scope' with $.declaration declaration" }
}

my class X::Declaration::Scope::Multi is X::Declaration::Scope {
method message() {
"Cannot use '$.scope' with individual multi candidates. Please declare an {$.scope}-scoped proto instead";
}
}

my class X::Anon::Multi does X::Comp {
has $.multiness;
has $.routine-type = 'routine';
Expand Down

0 comments on commit b4caaa4

Please sign in to comment.