mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-13 15:00:06 -04:00
Remove try/catch in execution - fix #75
This commit is contained in:
parent
07354cddbc
commit
056fb76492
1 changed files with 21 additions and 29 deletions
|
@ -58,37 +58,29 @@ var execute = function (sequencer, thread) {
|
||||||
console.log('and stack frame: ', currentStackFrame);
|
console.log('and stack frame: ', currentStackFrame);
|
||||||
}
|
}
|
||||||
var primitiveReturnValue = null;
|
var primitiveReturnValue = null;
|
||||||
try {
|
// @todo deal with the return value
|
||||||
// @todo deal with the return value
|
primitiveReturnValue = blockFunction(argValues, {
|
||||||
primitiveReturnValue = blockFunction(argValues, {
|
yield: thread.yield.bind(thread),
|
||||||
yield: thread.yield.bind(thread),
|
done: function() {
|
||||||
done: function() {
|
sequencer.proceedThread(thread);
|
||||||
sequencer.proceedThread(thread);
|
},
|
||||||
},
|
timeout: YieldTimers.timeout,
|
||||||
timeout: YieldTimers.timeout,
|
stackFrame: currentStackFrame,
|
||||||
stackFrame: currentStackFrame,
|
startSubstack: function (substackNum) {
|
||||||
startSubstack: function (substackNum) {
|
sequencer.stepToSubstack(thread, substackNum);
|
||||||
sequencer.stepToSubstack(thread, substackNum);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
console.error(
|
|
||||||
'Exception calling block function for opcode: ' +
|
|
||||||
opcode + '\n' + e);
|
|
||||||
} finally {
|
|
||||||
// Update if the thread has set a yield timer ID
|
|
||||||
// @todo hack
|
|
||||||
if (YieldTimers.timerId > oldYieldTimerId) {
|
|
||||||
thread.yieldTimerId = YieldTimers.timerId;
|
|
||||||
}
|
}
|
||||||
if (DEBUG_BLOCK_CALLS) {
|
});
|
||||||
console.log('ending stack frame: ', currentStackFrame);
|
// Update if the thread has set a yield timer ID
|
||||||
console.log('returned: ', primitiveReturnValue);
|
// @todo hack
|
||||||
console.groupEnd();
|
if (YieldTimers.timerId > oldYieldTimerId) {
|
||||||
}
|
thread.yieldTimerId = YieldTimers.timerId;
|
||||||
return primitiveReturnValue;
|
|
||||||
}
|
}
|
||||||
|
if (DEBUG_BLOCK_CALLS) {
|
||||||
|
console.log('ending stack frame: ', currentStackFrame);
|
||||||
|
console.log('returned: ', primitiveReturnValue);
|
||||||
|
console.groupEnd();
|
||||||
|
}
|
||||||
|
return primitiveReturnValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = execute;
|
module.exports = execute;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue