mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-26 22:20:41 -04:00
Mutations in block representation; an unfeatured procedure call (#212)
* Add scratch3_procedures and no-op for defnoreturn * Add mutation adapter to parse mutations in CREATE/CHANGE events * Add mutation-to-XML * Update spec map for Blockly procedure names * Placeholder for procedure special cases * Basic stepping to procedures * Remove extra case * Validation for changeBlock
This commit is contained in:
parent
dd624aea06
commit
0a66c62f6a
9 changed files with 171 additions and 8 deletions
src/engine
|
@ -132,6 +132,12 @@ var execute = function (sequencer, thread) {
|
|||
argValues[inputName] = currentStackFrame.reported[inputName];
|
||||
}
|
||||
|
||||
// Add any mutation to args (e.g., for procedures).
|
||||
var mutation = target.blocks.getMutation(currentBlockId);
|
||||
if (mutation) {
|
||||
argValues.mutation = mutation;
|
||||
}
|
||||
|
||||
// If we've gotten this far, all of the input blocks are evaluated,
|
||||
// and `argValues` is fully populated. So, execute the block primitive.
|
||||
// First, clear `currentStackFrame.reported`, so any subsequent execution
|
||||
|
@ -155,6 +161,9 @@ var execute = function (sequencer, thread) {
|
|||
startBranch: function (branchNum) {
|
||||
sequencer.stepToBranch(thread, branchNum);
|
||||
},
|
||||
startProcedure: function (procedureName) {
|
||||
sequencer.stepToProcedure(thread, procedureName);
|
||||
},
|
||||
startHats: function(requestedHat, opt_matchFields, opt_target) {
|
||||
return (
|
||||
runtime.startHats(requestedHat, opt_matchFields, opt_target)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue