mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-27 22:50:22 -04:00
Simplify execute
hat check.
In case a reporter has side-effects, we'd probably like to run hat predicates even if there is no next block.
This commit is contained in:
parent
4f81033762
commit
29887e24c9
1 changed files with 5 additions and 15 deletions
|
@ -35,23 +35,13 @@ var execute = function (sequencer, thread) {
|
|||
// Hats are implemented slightly differently from regular blocks.
|
||||
// If they have an associated block function, it's treated as a predicate;
|
||||
// if not, execution will proceed right through it (as a no-op).
|
||||
if (isHat) {
|
||||
var nextBlock = target.blocks.getNextBlock(currentBlockId);
|
||||
if (!nextBlock) {
|
||||
// Hat with no next block - don't try to evaluate it.
|
||||
sequencer.retireThread(thread);
|
||||
return;
|
||||
}
|
||||
if (!blockFunction) {
|
||||
// No predicate for the hat - just continue to next block.
|
||||
sequencer.proceedThread(thread);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!blockFunction) {
|
||||
if (!blockFunction) {
|
||||
if (!isHat) {
|
||||
console.warn('Could not get implementation for opcode: ' + opcode);
|
||||
return;
|
||||
}
|
||||
// Skip through the block.
|
||||
// (either hat with no predicate, or missing op).
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate values for arguments (inputs).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue