Fixed opcode debugging for arguments
This commit is contained in:
parent
eb4dc36b10
commit
5f6195177a
1 changed files with 11 additions and 2 deletions
|
@ -135,7 +135,7 @@ Interpreter.prototype.stepActiveThread = function() {
|
||||||
if (b == null) return;
|
if (b == null) return;
|
||||||
this.yield = false;
|
this.yield = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
this.opCount++;
|
++this.opCount;
|
||||||
// Advance the "program counter" to the next block before running the primitive.
|
// Advance the "program counter" to the next block before running the primitive.
|
||||||
// Control flow primitives (e.g. if) may change activeThread.nextBlock.
|
// Control flow primitives (e.g. if) may change activeThread.nextBlock.
|
||||||
this.activeThread.nextBlock = b.nextBlock;
|
this.activeThread.nextBlock = b.nextBlock;
|
||||||
|
@ -210,7 +210,16 @@ Interpreter.prototype.restartThread = function(b, targetObj) {
|
||||||
Interpreter.prototype.arg = function(block, index) {
|
Interpreter.prototype.arg = function(block, index) {
|
||||||
var arg = block.args[index];
|
var arg = block.args[index];
|
||||||
if ((typeof(arg) == 'object') && (arg.constructor == Block)) {
|
if ((typeof(arg) == 'object') && (arg.constructor == Block)) {
|
||||||
this.opCount++;
|
++this.opCount;
|
||||||
|
if (this.debugOps && this.debugFunc) {
|
||||||
|
var finalArgs = [];
|
||||||
|
for (var i = 0; i < arg.args.length; ++i) {
|
||||||
|
finalArgs.push(this.arg(arg, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.debugFunc(this.opCount2, arg.op, finalArgs);
|
||||||
|
++this.opCount2;
|
||||||
|
}
|
||||||
return arg.primFcn(arg); // expression
|
return arg.primFcn(arg); // expression
|
||||||
}
|
}
|
||||||
return arg;
|
return arg;
|
||||||
|
|
Reference in a new issue