Minor formatting and type casting adjustment to make codebase internally consistent
This commit is contained in:
parent
1bd49e4e49
commit
586f29a285
10 changed files with 259 additions and 217 deletions
|
@ -136,7 +136,7 @@ Interpreter.prototype.stepActiveThread = function() {
|
|||
if (b == null) return;
|
||||
this.yield = false;
|
||||
while (true) {
|
||||
if (this.activeThread.paused) return;
|
||||
if (this.activeThread.paused) return;
|
||||
|
||||
++this.opCount;
|
||||
// Advance the "program counter" to the next block before running the primitive.
|
||||
|
@ -319,8 +319,11 @@ Interpreter.prototype.lookupPrim = function(op) {
|
|||
Interpreter.prototype.primNoop = function(b) { console.log(b.op); };
|
||||
|
||||
Interpreter.prototype.primWait = function(b) {
|
||||
if (interp.activeThread.firstTime) interp.startTimer(interp.numarg(b, 0));
|
||||
else interp.checkTimer();
|
||||
if (interp.activeThread.firstTime) {
|
||||
interp.startTimer(interp.numarg(b, 0));
|
||||
} else {
|
||||
interp.checkTimer();
|
||||
}
|
||||
};
|
||||
|
||||
Interpreter.prototype.primRepeat = function(b) {
|
||||
|
@ -348,7 +351,9 @@ Interpreter.prototype.broadcast = function(b, waitFlag) {
|
|||
}
|
||||
}
|
||||
runtime.allStacksDo(findReceivers);
|
||||
for (pair in receivers) interp.restartThread(receivers[pair][0], receivers[pair][1]);
|
||||
for (pair in receivers) {
|
||||
interp.restartThread(receivers[pair][0], receivers[pair][1]);
|
||||
}
|
||||
if (!waitFlag) return;
|
||||
interp.activeThread.tmpObj = receivers;
|
||||
interp.activeThread.firstTime = false;
|
||||
|
@ -378,7 +383,7 @@ Interpreter.prototype.isRunning = function(b) {
|
|||
|
||||
Interpreter.prototype.startSubstack = function(b, isLoop, secondSubstack) {
|
||||
// Start the substack of a control structure command such as if or forever.
|
||||
b.isLoop = !!isLoop;
|
||||
b.isLoop = Boolean(isLoop);
|
||||
this.activeThread.stack.push(b); // remember the block that started the substack
|
||||
if (!secondSubstack) {
|
||||
this.activeThread.nextBlock = b.substack;
|
||||
|
|
Reference in a new issue