From 5f88fc93bb9a21eb281c30a2fbd75623113dbafc Mon Sep 17 00:00:00 2001 From: jmoenig Date: Thu, 11 Jul 2013 17:45:09 +0200 Subject: preserve nested reporters in "kicked out" variadic inputs instead of "swallowing" them. also new: floor() function in monadic math reporter's drop-down --- blocks.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'blocks.js') diff --git a/blocks.js b/blocks.js index 4501b0f..4f6466a 100644 --- a/blocks.js +++ b/blocks.js @@ -412,7 +412,7 @@ SyntaxElementMorph.prototype.allEmptySlots = function () { SyntaxElementMorph.prototype.replaceInput = function (oldArg, newArg) { var scripts = this.parentThatIsA(ScriptsMorph), - replacement, + replacement = newArg, idx = this.children.indexOf(oldArg), nb; @@ -424,10 +424,13 @@ SyntaxElementMorph.prototype.replaceInput = function (oldArg, newArg) { newArg.parent.removeChild(newArg); } - if (oldArg instanceof MultiArgMorph && this.dynamicInputLabels) { - replacement = new ArgLabelMorph(newArg); - } else { - replacement = newArg; + if (oldArg instanceof MultiArgMorph) { + oldArg.inputs().forEach(function (inp) { // preserve nested reporters + oldArg.replaceInput(inp, new InputSlotMorph()); + }); + if (this.dynamicInputLabels) { + replacement = new ArgLabelMorph(newArg); + } } replacement.parent = this; @@ -969,6 +972,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { false, { abs : ['abs'], + floor : ['floor'], sqrt : ['sqrt'], sin : ['sin'], cos : ['cos'], -- cgit v1.3.1