diff options
| author | jmoenig <jens@moenig.org> | 2013-05-14 16:16:21 +0200 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2013-05-14 16:16:21 +0200 |
| commit | d267b696af1e7a429c4b31dc87b46dc638c3509f (patch) | |
| tree | 55ea3f81aa2f60b552ad0a649e58fc2d43debbc9 /threads.js | |
| parent | 4c44efdc1e7a2c1bb06274b206de7a982fb03d12 (diff) | |
| download | snap-yow-d267b696af1e7a429c4b31dc87b46dc638c3509f.tar.gz snap-yow-d267b696af1e7a429c4b31dc87b46dc638c3509f.zip | |
Broadcast & Message enhancements, fixed #93
* When I receive <any msg> option
* getLastMessage reporter + watcher
Diffstat (limited to 'threads.js')
| -rw-r--r-- | threads.js | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -83,7 +83,7 @@ ArgLabelMorph, localize*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2013-April-19'; +modules.threads = '2013-May-14'; var ThreadManager; var Process; @@ -744,8 +744,7 @@ Process.prototype.evaluate = function ( extra, parms = args.asArray(), i, - value, - upvars; + value; if (!outer.receiver) { outer.receiver = context.receiver; // for custom blocks @@ -815,9 +814,7 @@ Process.prototype.evaluate = function ( } } } - if (upvars) { - runnable.upvars = upvars; - } else if (this.context.upvars) { + if (this.context.upvars) { runnable.upvars = new UpvarReference(this.context.upvars); } @@ -1665,6 +1662,7 @@ Process.prototype.doBroadcast = function (message) { procs = []; if (message !== '') { + stage.lastMessage = message; stage.children.concat(stage).forEach(function (morph) { if (morph instanceof SpriteMorph || morph instanceof StageMorph) { hats = hats.concat(morph.allHatBlocksFor(message)); @@ -1693,6 +1691,17 @@ Process.prototype.doBroadcastAndWait = function (message) { this.pushContext(); }; +Process.prototype.getLastMessage = function () { + var stage; + if (this.homeContext.receiver) { + stage = this.homeContext.receiver.parentThatIsA(StageMorph); + if (stage) { + return stage.getLastMessage(); + } + } + return ''; +}; + // Process type inference Process.prototype.reportIsA = function (thing, typeString) { |
