More work on connection type checks

This commit is contained in:
Rachel Fenichel
2020-07-14 13:49:58 -06:00
parent bb8348befd
commit 450aed0aa2
6 changed files with 163 additions and 139 deletions

View File

@@ -456,7 +456,8 @@ Blockly.Block.prototype.unplugFromRow_ = function(opt_healStack) {
// Disconnect the child block.
childConnection.disconnect();
// Connect child to the parent if possible, otherwise bump away.
if (childConnection.checkType(parentConnection)) {
if (this.workspace.connectionTypeChecker.canConnect(
childConnection, parentConnection, false, false)) {
parentConnection.connect(childConnection);
} else {
childConnection.onFailedConnect(parentConnection);
@@ -508,7 +509,9 @@ Blockly.Block.prototype.unplugFromStack_ = function(opt_healStack) {
// Disconnect the next statement.
var nextTarget = this.nextConnection.targetConnection;
nextTarget.disconnect();
if (previousTarget && previousTarget.checkType(nextTarget)) {
if (previousTarget &&
this.workspace.connectionTypeChecker.canConnect(
previousTarget, nextTarget, false, false)) {
// Attach the next statement to the previous statement.
previousTarget.connect(nextTarget);
}