diff options
| author | jmoenig <jens@moenig.org> | 2013-07-11 17:45:09 +0200 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2013-07-11 17:45:09 +0200 |
| commit | 5f88fc93bb9a21eb281c30a2fbd75623113dbafc (patch) | |
| tree | 0a4d841653026e73927c0bda7007df03bb0ef55c /blocks.js | |
| parent | eb8aef28c82d86f43ac16d80d5c3a1b6a39561ac (diff) | |
| download | snap-byow-5f88fc93bb9a21eb281c30a2fbd75623113dbafc.tar.gz snap-byow-5f88fc93bb9a21eb281c30a2fbd75623113dbafc.zip | |
preserve nested reporters in "kicked out" variadic inputs
instead of "swallowing" them.
also new: floor() function in monadic math reporter's drop-down
Diffstat (limited to 'blocks.js')
| -rw-r--r-- | blocks.js | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -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'], |
