Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only allow is rw on Scalar parameters.
  • Loading branch information
jnthn committed Sep 24, 2015
1 parent ab042e1 commit eacdc8d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Perl6/Metamodel/BOOTSTRAP.nqp
Expand Up @@ -1464,10 +1464,14 @@ BEGIN {
my $SIG_ELEM_IS_RW := 256;
my $SIG_ELEM_IS_OPTIONAL := 2048;
my $dcself := nqp::decont($self);
my int $flags := nqp::getattr_i($dcself, Parameter, '$!flags');
my int $flags := nqp::getattr_i($dcself, Parameter, '$!flags');
if $flags +& $SIG_ELEM_IS_OPTIONAL {
nqp::die("Cannot use 'is rw' on an optional parameter");
}
my str $varname := nqp::getattr_s($dcself, Parameter, '$!variable_name');
unless nqp::isnull_s($varname) || nqp::eqat($varname, '$', 0) {
nqp::die("Can only use 'is rw' on a scalar ('$' sigil) parameter");
}
my $cd := nqp::getattr($dcself, Parameter, '$!container_descriptor');
if nqp::defined($cd) { $cd.set_rw(1) }
nqp::bindattr_i($dcself, Parameter, '$!flags', $flags + $SIG_ELEM_IS_RW);
Expand Down

0 comments on commit eacdc8d

Please sign in to comment.