Skip to content

Commit

Permalink
first X::Parameter class; many more to come...
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Jan 24, 2012
1 parent 78bee73 commit 95f97e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Perl6/Actions.pm
Expand Up @@ -2248,10 +2248,10 @@ class Perl6::Actions is HLL::Actions {
my $quant := $<quant>;
if $<default_value> {
if $quant eq '*' {
$/.CURSOR.panic("Cannot put default on slurpy parameter");
$*W.throw($/, ['X', 'Parameter', 'Default'], how => p6box_s('slurpy'));
}
if $quant eq '!' {
$/.CURSOR.panic("Cannot put default on required parameter");
$*W.throw($/, ['X', 'Parameter', 'Default'], how => p6box_s('required'));
}
my $val := $<default_value>[0].ast;
if $val<has_compile_time_value> {
Expand Down
5 changes: 5 additions & 0 deletions src/core/Exceptions.pm
Expand Up @@ -86,3 +86,8 @@ my class X::Obsolete does X::Comp {
has $.when = 'in Perl 6';
method message() { "Unsupported use of $.old; $.when please use $.new" }
}

my class X::Parameter::Default does X::Comp {
has $.how;
method message() { "Cannot put default on $.how parameter" };
}

0 comments on commit 95f97e4

Please sign in to comment.