Permalink
Browse files

Add "is readonly" and "is rw" traits on variables

  • Loading branch information...
1 parent cd4831d commit c428a378f86988d0d0785a83f6763673a8f75eb7 @lizmat lizmat committed Jul 26, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/core/Variable.pm
@@ -11,3 +11,9 @@ multi trait_mod:<is>(Variable:D $v, :$default!) {
$v.var = $default;
nqp::getattr($v.var, $v.VAR.WHAT, '$!descriptor').set_default($default);
}
+multi trait_mod:<is>(Variable:D $v, :$readonly!) {
+ nqp::getattr($v.var, $v.VAR.WHAT, '$!descriptor').set_rw(!$readonly);
+}
+multi trait_mod:<is>(Variable:D $v, :$rw!) {
+ nqp::getattr($v.var, $v.VAR.WHAT, '$!descriptor').set_rw($rw);
+}

0 comments on commit c428a37

Please sign in to comment.