mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-09 06:21:59 -05:00
Update nextBlock to be set before primitive call
This commit is contained in:
parent
7eef10ef8c
commit
3eeccf1970
1 changed files with 8 additions and 3 deletions
|
@ -58,10 +58,16 @@ Sequencer.prototype.stepThreads = function (threads) {
|
|||
* @param {!Thread} thread Thread object to step
|
||||
*/
|
||||
Sequencer.prototype.stepThread = function (thread) {
|
||||
var opcode = this.runtime._getOpcode(thread.nextBlock);
|
||||
// Save the current block and set the nextBlock.
|
||||
// If the primitive would like to do control flow,
|
||||
// it can overwrite nextBlock.
|
||||
var currentBlock = thread.nextBlock;
|
||||
thread.nextBlock = this.runtime._getNextBlock(thread.nextBlock);
|
||||
|
||||
var opcode = this.runtime._getOpcode(currentBlock);
|
||||
|
||||
if (!opcode) {
|
||||
console.warn('Could not get opcode for block: ' + thread.nextBlock);
|
||||
console.warn('Could not get opcode for block: ' + currentBlock);
|
||||
}
|
||||
else {
|
||||
var blockFunction = this.runtime.getOpcodeFunction(opcode);
|
||||
|
@ -79,7 +85,6 @@ Sequencer.prototype.stepThread = function (thread) {
|
|||
}
|
||||
}
|
||||
|
||||
thread.nextBlock = this.runtime._getNextBlock(thread.nextBlock);
|
||||
};
|
||||
|
||||
module.exports = Sequencer;
|
||||
|
|
Loading…
Reference in a new issue