Skip to content
Permalink
Browse files

Check if a class can .STORE before .newing it

This fixes the issue caused the last commit with (1..42) >>+>> 666.
  • Loading branch information...
lizmat committed Nov 11, 2018
1 parent 78f6420 commit 63ae9dcc5dfae7aa0fb020d6785cea4e4328ed3f
Showing with 13 additions and 7 deletions.
  1. +13 −7 src/core/Hyper.pm6
@@ -94,9 +94,11 @@ class Hyper {
my \result := nqp::eqaddr(left.WHAT,List)
|| nqp::eqaddr(left.WHAT,Slip)
?? nqp::p6bindattrinvres(nqp::create(left),List,'$!reified',values)
!! left.WHAT.new(
nqp::p6bindattrinvres(nqp::create(List),List,'$!reified',values)
);
!! nqp::can(left,"STORE")
?? left.WHAT.new(nqp::p6bindattrinvres(
nqp::create(List),List,'$!reified',values
))
!! nqp::p6bindattrinvres(nqp::create(List),List,'$!reified',values);
nqp::iscont(left) ?? result.item !! result
}

@@ -123,10 +125,14 @@ class Hyper {

my \result := nqp::eqaddr(right.WHAT,List)
|| nqp::eqaddr(right.WHAT,Slip)
?? nqp::p6bindattrinvres(nqp::create(right),List,'$!reified',values)
!! right.WHAT.new(
nqp::p6bindattrinvres(nqp::create(List),List,'$!reified',values)
);
?? nqp::p6bindattrinvres( # List or Slip
nqp::create(right),List,'$!reified',values
)
!! nqp::can(right,"STORE")
?? right.WHAT.new(nqp::p6bindattrinvres(
nqp::create(List),List,'$!reified',values
))
!! nqp::p6bindattrinvres(nqp::create(List),List,'$!reified',values);
nqp::iscont(right) ?? result.item !! result
}

0 comments on commit 63ae9dc

Please sign in to comment.
You can’t perform that action at this time.