Created
February 18, 2018 19:11
-
-
Save usev6/b81dd9afb68cc55398c950c61760a0fc to your computer and use it in GitHub Desktop.
diff fixing NullPointerException method clone(Array:D) {} and method clone(Hash:D) {}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/Array.pm b/src/core/Array.pm | |
index 6fff8b91f..c435a9d51 100644 | |
--- a/src/core/Array.pm | |
+++ b/src/core/Array.pm | |
@@ -51,14 +51,14 @@ my class Array { # declared in BOOTSTRAP | |
nqp::stmts( | |
(my \iter := self.iterator), | |
(my \result := nqp::p6bindattrinvres(nqp::create(self), | |
- Array, '$!descriptor', nqp::clone($!descriptor))), | |
+ Array, '$!descriptor', nqp::isnull($!descriptor) ?? Mu !! nqp::clone($!descriptor))), | |
nqp::if( | |
nqp::eqaddr( | |
IterationEnd, | |
iter.push-until-lazy: | |
my \target := ArrayReificationTarget.new( | |
(my \buffer := nqp::create(IterationBuffer)), | |
- nqp::clone($!descriptor))), | |
+ nqp::isnull($!descriptor) ?? Mu !! nqp::clone($!descriptor))), | |
nqp::p6bindattrinvres(result, List, '$!reified', buffer), | |
nqp::stmts( | |
nqp::bindattr(result, List, '$!reified', buffer), | |
diff --git a/src/core/Hash.pm b/src/core/Hash.pm | |
index 88739bcff..63068afda 100644 | |
--- a/src/core/Hash.pm | |
+++ b/src/core/Hash.pm | |
@@ -43,7 +43,7 @@ my class Hash { # declared in BOOTSTRAP | |
nqp::p6bindattrinvres( | |
nqp::create(self),Map,'$!storage', | |
nqp::clone(nqp::getattr(self,Map,'$!storage'))), | |
- Hash, '$!descriptor', nqp::clone($!descriptor)) | |
+ Hash, '$!descriptor', nqp::isnull($!descriptor) ?? Mu !! nqp::clone($!descriptor)) | |
} | |
method !AT-KEY-CONTAINER(Str:D \key) is raw { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment