Browse files

Make (%@)a is default(42) no longer die

  • Loading branch information...
1 parent 1f57da5 commit 6edd19dd97527ee6942bfeca4a6d5670a63f2e71 @lizmat lizmat committed Aug 8, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/core/Variable.pm
View
8 src/core/Variable.pm
@@ -35,7 +35,13 @@ multi trait_mod:<is>(Variable:D $v, Mu:U $is ) {
multi trait_mod:<is>(Variable:D $v, :$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);
+ nqp::getattr(
+ $v.var,
+ $v.var.VAR.WHAT.perl ~~ m/\+/ # we have types mixed in
+ ?? $v.var.VAR.WHAT.^mro[1] # (Hash+{TypedHash}) -> (Hash)
+ !! $v.var.VAR.WHAT,
+ '$!descriptor',
+ ).set_default($default);
}
multi trait_mod:<is>(Variable:D $v, :$dynamic!) {
# must be a noop for now, as apparently outer scope lexicals are *always*

0 comments on commit 6edd19d

Please sign in to comment.