enable Zombiefication of JS-Functions

you can now redirect “this” in a JS function by binding it to another
sprite using the OF block
pull/3/merge
jmoenig 2014-08-13 17:43:49 +02:00
rodzic 0333925e91
commit 130e105ea3
3 zmienionych plików z 11 dodań i 5 usunięć

Wyświetl plik

@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2014-July-30'; modules.blocks = '2014-August-13';
var SyntaxElementMorph; var SyntaxElementMorph;
@ -396,10 +396,11 @@ SyntaxElementMorph.prototype.allInputs = function () {
SyntaxElementMorph.prototype.allEmptySlots = function () { SyntaxElementMorph.prototype.allEmptySlots = function () {
/* /*
answer empty input slots of all children excluding myself, answer empty input slots of all children excluding myself,
but omit those in nested rings (lambdas) but omit those in nested rings (lambdas) and JS-Function primitives
*/ */
var empty = []; var empty = [];
if (!(this instanceof RingMorph)) { if (!(this instanceof RingMorph) &&
(this.selector !== 'reportJSFunction')) {
this.children.forEach(function (morph) { this.children.forEach(function (morph) {
if (morph.isEmptySlot && morph.isEmptySlot()) { if (morph.isEmptySlot && morph.isEmptySlot()) {
empty.push(morph); empty.push(morph);

Wyświetl plik

@ -2256,3 +2256,8 @@ ______
* Objects: propagate HIDE and SHOW to nested sprite parts * Objects: propagate HIDE and SHOW to nested sprite parts
* GUI: propagate DELETE to nested sprite parts * GUI: propagate DELETE to nested sprite parts
* Blocks, Threads: export script pic with result bubble (shift-context-menu of reporter scripts) * Blocks, Threads: export script pic with result bubble (shift-context-menu of reporter scripts)
* updated Portuguese translation, thanks, Manuel!
140813
------
* Threads, Blocks: enable Zombiefication of JS-Functions

Wyświetl plik

@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.threads = '2014-July-30'; modules.threads = '2014-August-13';
var ThreadManager; var ThreadManager;
var Process; var Process;
@ -774,7 +774,7 @@ Process.prototype.evaluate = function (
if (!context) {return null; } if (!context) {return null; }
if (context instanceof Function) { if (context instanceof Function) {
return context.apply( return context.apply(
this.homeContext.receiver, this.blockReceiver(),
args.asArray().concat([this]) args.asArray().concat([this])
); );
} }