mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
remove empty procedure_definetion block
The engine supports blocks that do not have defined functions.
This commit is contained in:
parent
11b52c4e60
commit
ffcd0e6518
3 changed files with 6 additions and 7 deletions
|
@ -13,17 +13,16 @@ class Scratch3ProcedureBlocks {
|
|||
*/
|
||||
getPrimitives () {
|
||||
return {
|
||||
procedures_definition: this.definition,
|
||||
// procedures_definition is the top block of a procedure but has no
|
||||
// effect of its own.
|
||||
procedures_definition: null,
|
||||
|
||||
procedures_call: this.call,
|
||||
argument_reporter_string_number: this.argumentReporterStringNumber,
|
||||
argument_reporter_boolean: this.argumentReporterBoolean
|
||||
};
|
||||
}
|
||||
|
||||
definition () {
|
||||
// No-op: execute the blocks.
|
||||
}
|
||||
|
||||
call (args, util) {
|
||||
if (!util.stackFrame.executed) {
|
||||
const procedureCode = args.mutation.proccode;
|
||||
|
|
|
@ -279,7 +279,7 @@ class BlockCached {
|
|||
// Assign opcode isHat and blockFunction data to avoid dynamic lookups.
|
||||
this._isHat = runtime.getIsHat(opcode);
|
||||
this._blockFunction = runtime.getOpcodeFunction(opcode);
|
||||
this._definedBlockFunction = typeof this._blockFunction !== 'undefined';
|
||||
this._definedBlockFunction = typeof this._blockFunction === 'function';
|
||||
|
||||
// Store the current shadow value if there is a shadow value.
|
||||
const fieldKeys = Object.keys(fields);
|
||||
|
|
|
@ -713,7 +713,7 @@ class Runtime extends EventEmitter {
|
|||
if (packageObject.getPrimitives) {
|
||||
const packagePrimitives = packageObject.getPrimitives();
|
||||
for (const op in packagePrimitives) {
|
||||
if (packagePrimitives.hasOwnProperty(op)) {
|
||||
if (typeof packagePrimitives[op] === 'function') {
|
||||
this._primitives[op] =
|
||||
packagePrimitives[op].bind(packageObject);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue