summaryrefslogtreecommitdiff
path: root/threads.js
diff options
context:
space:
mode:
Diffstat (limited to 'threads.js')
-rw-r--r--threads.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/threads.js b/threads.js
index dfa335e..c6b0fde 100644
--- a/threads.js
+++ b/threads.js
@@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/
// Global stuff ////////////////////////////////////////////////////////
-modules.threads = '2014-November-15';
+modules.threads = '2014-November-20';
var ThreadManager;
var Process;
@@ -225,8 +225,9 @@ ThreadManager.prototype.removeTerminatedProcesses = function () {
var remaining = [];
this.processes.forEach(function (proc) {
if (!proc.isRunning() && !proc.errorFlag && !proc.isDead) {
- proc.topBlock.removeHighlight();
-
+ if (proc.topBlock instanceof BlockMorph) {
+ proc.topBlock.removeHighlight();
+ }
if (proc.prompter) {
proc.prompter.destroy();
if (proc.homeContext.receiver.stopTalking) {
@@ -880,6 +881,9 @@ Process.prototype.fork = function (context, args) {
'continuations cannot be forked'
);
}
+ if (!(context instanceof Context)) {
+ throw new Error('expecting a ring but getting ' + context);
+ }
var outer = new Context(null, null, context.outerContext),
runnable = new Context(null,
@@ -945,6 +949,9 @@ Process.prototype.fork = function (context, args) {
};
Process.prototype.doReport = function (value) {
+ if (this.context.expression.partOfCustomCommand) {
+ return this.doStopBlock();
+ }
while (this.context && this.context.expression !== 'exitReporter') {
if (this.context.expression === 'doStopWarping') {
this.doStopWarping();
@@ -1042,8 +1049,6 @@ Process.prototype.evaluateCustomBlock = function () {
}
if (runnable.expression instanceof CommandBlockMorph) {
- runnable.expression = runnable.expression.blockSequence();
-
// insert a reporter exit tag for the
// CALL SCRIPT primitive variant
if (this.context.expression.definition.type !== 'command') {
@@ -1054,7 +1059,12 @@ Process.prototype.evaluateCustomBlock = function () {
outer.receiver
);
runnable.parentContext = exit;
+ } else { // mark all REPORT blocks as being part of a custom command
+ runnable.expression.allReportBlocks().forEach(function (rb) {
+ rb.partOfCustomCommand = true;
+ });
}
+ runnable.expression = runnable.expression.blockSequence();
}
};