From 18e4228399f44f4f1c6de1c68a9ac266a9d38f9d Mon Sep 17 00:00:00 2001 From: Tim Mickel Date: Mon, 6 Jun 2016 14:53:59 -0400 Subject: [PATCH] Update runtime's handling of delete for new blocks structure --- src/engine/runtime.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/engine/runtime.js b/src/engine/runtime.js index 1c7c370f0..55a13d33a 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -168,14 +168,11 @@ Runtime.prototype.deleteBlock = function (e) { this.deleteBlock({id: block.next}); } - // Delete substacks and fields - for (var field in block.fields) { - if (field === 'SUBSTACK') { - this.deleteBlock({id: block.fields[field].value}); - } else { - for (var shadow in block.fields[field].blocks) { - this.deleteBlock({id: shadow}); - } + // Delete inputs (including substacks) + for (var input in block.inputs) { + // If it's null, the block in this input moved away. + if (block.inputs[input].block !== null) { + this.deleteBlock({id: block.inputs[input].block}); } }