summaryrefslogtreecommitdiff
path: root/blocks.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-07-11 17:45:09 +0200
committerjmoenig <jens@moenig.org>2013-07-11 17:45:09 +0200
commit5f88fc93bb9a21eb281c30a2fbd75623113dbafc (patch)
tree0a4d841653026e73927c0bda7007df03bb0ef55c /blocks.js
parenteb8aef28c82d86f43ac16d80d5c3a1b6a39561ac (diff)
downloadsnap-5f88fc93bb9a21eb281c30a2fbd75623113dbafc.tar.gz
snap-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.js14
1 files changed, 9 insertions, 5 deletions
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'],