From f05eed64eb88bc2f7927e906241f61db6d300586 Mon Sep 17 00:00:00 2001
From: Andrew n marshall <9916202+AnmAtAnm@users.noreply.github.com>
Date: Thu, 7 Feb 2019 13:15:41 -0800
Subject: [PATCH] Check against healing child shadow blocks. Fixes #2227,
healing values. Also applies to shadow next blocks. Added a playground test
block group with a shadow statement.
---
core/block.js | 6 ++++--
tests/playground.html | 16 ++++++++++++++++
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/core/block.js b/core/block.js
index d62c7249a..cffe2c090 100644
--- a/core/block.js
+++ b/core/block.js
@@ -379,7 +379,9 @@ Blockly.Block.prototype.unplugFromRow_ = function(opt_healStack) {
}
var thisConnection = this.getOnlyValueConnection_();
- if (!thisConnection || !thisConnection.isConnected()) {
+ if (!thisConnection ||
+ !thisConnection.isConnected() ||
+ thisConnection.targetBlock().isShadow()) {
// Too many or too few possible connections on this block, or there's
// nothing on the other side of this connection.
return;
@@ -430,7 +432,7 @@ Blockly.Block.prototype.unplugFromStack_ = function(opt_healStack) {
this.previousConnection.disconnect();
}
var nextBlock = this.getNextBlock();
- if (opt_healStack && nextBlock) {
+ if (opt_healStack && nextBlock && !nextBlock.isShadow()) {
// Disconnect the next statement.
var nextTarget = this.nextConnection.targetConnection;
nextTarget.disconnect();
diff --git a/tests/playground.html b/tests/playground.html
index 983af43ba..364ca0468 100644
--- a/tests/playground.html
+++ b/tests/playground.html
@@ -1123,6 +1123,22 @@ h1 {
+
+
+
+ Shadow value
+
+
+
+
+
+
+ Shadow statement
+
+
+
+
+