Skip to content
Browse files

Make sure we only assign the default value for Scalars

  • Loading branch information...
1 parent eea1906 commit 1f57da5881e421615468981f349c8298d00c4164 @lizmat lizmat committed Aug 8, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/core/Variable.pm
View
3 src/core/Variable.pm
@@ -33,7 +33,8 @@ multi trait_mod:<is>(Variable:D $v, Mu:U $is ) {
);
}
multi trait_mod:<is>(Variable:D $v, :$default!) {
- $v.var = $default; # make sure we start with the default
+ # make sure we start with the default if a scalar
+ $v.var = $default if $v.var.VAR.WHAT ~~ Scalar;
nqp::getattr($v.var, $v.var.VAR.WHAT, '$!descriptor').set_default($default);
}
multi trait_mod:<is>(Variable:D $v, :$dynamic!) {

0 comments on commit 1f57da5

Please sign in to comment.
Something went wrong with that request. Please try again.