tweaked JS-Compiler to better handle process related ops

upd4.2
jmoenig 2018-05-08 07:08:54 +02:00
rodzic 47fd2fd934
commit d95c7b4696
2 zmienionych plików z 12 dodań i 2 usunięć

Wyświetl plik

@ -4107,3 +4107,7 @@ in development:
180503
------
* GUI: (again) randomize pen color when creating a new sprite
180508
------
* Threads: tweaked JS-Compiler to better handle process related ops

Wyświetl plik

@ -62,7 +62,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy,
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph,
TableFrameMorph, ColorSlotMorph, isSnapObject*/
modules.threads = '2018-May-02';
modules.threads = '2018-May-08';
var ThreadManager;
var Process;
@ -4467,7 +4467,13 @@ JSCompiler.prototype.compileExpression = function (block) {
: (this.source.receiver || this.process.receiver);
rcvr = target.constructor.name + '.prototype';
args = this.compileInputs(inputs);
return rcvr + '.' + selector + '.apply('+ rcvr + ', [' + args +'])';
if (isSnapObject(target)) {
return rcvr + '.' + selector + '.apply('+ rcvr + ', [' + args +'])';
} else {
return 'arguments[arguments.length - 1].' +
selector +
'.apply(arguments[arguments.length - 1], [' + args +'])';
}
}
};