preserve nested reporters in "kicked out" variadic inputs

instead of "swallowing" them.

also new: floor() function in monadic math reporter's drop-down
pull/3/merge
jmoenig 2013-07-11 17:45:09 +02:00
rodzic eb8aef28c8
commit 5f88fc93bb
5 zmienionych plików z 20 dodań i 9 usunięć

Wyświetl plik

@ -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'],

Wyświetl plik

@ -1803,3 +1803,5 @@ ______
130711
------
* Blocks: fixed occasional flickering in scripting areas (caused by deleted feedback morphs, a bug that surfaced in Chrome 28 on OSX and may be due to a possible Chrome GC issue)
* Blocks: preserve nested blocks in the scripting area when replacing a variadic input list with another input ("kick out" the nested blocks instead of "swallowing" them)
* Blocks, Threads: new floor() function in monadic math reporter's drop-down

Wyświetl plik

@ -185,7 +185,7 @@ SnapTranslator.dict.de = {
'translator_e-mail':
'jens@moenig.org', // optional
'last_changed':
'2013-07-02', // this, too, will appear in the Translators tab
'2013-07-11', // this, too, will appear in the Translators tab
// GUI
// control bar:
@ -1176,6 +1176,8 @@ SnapTranslator.dict.de = {
// math functions
'abs':
'Betrag',
'floor':
'Abgerundet',
'sqrt':
'Wurzel',
'sin':

Wyświetl plik

@ -42,7 +42,7 @@
/*global modules, contains*/
modules.locale = '2013-July-02';
modules.locale = '2013-July-11';
// Global stuff
@ -149,7 +149,7 @@ SnapTranslator.dict.de = {
'translator_e-mail':
'jens@moenig.org',
'last_changed':
'2013-07-02'
'2013-07-11'
};
SnapTranslator.dict.it = {

Wyświetl plik

@ -83,7 +83,7 @@ ArgLabelMorph, localize*/
// Global stuff ////////////////////////////////////////////////////////
modules.threads = '2013-July-09';
modules.threads = '2013-July-11';
var ThreadManager;
var Process;
@ -1876,6 +1876,9 @@ Process.prototype.reportMonadic = function (fname, n) {
case 'abs':
result = Math.abs(x);
break;
case 'floor':
result = Math.floor(x);
break;
case 'sqrt':
result = Math.sqrt(x);
break;