diff --git a/src/blocks/scratch3_procedures.js b/src/blocks/scratch3_procedures.js index 56d3f3e7c..35ed6921d 100644 --- a/src/blocks/scratch3_procedures.js +++ b/src/blocks/scratch3_procedures.js @@ -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; diff --git a/src/engine/execute.js b/src/engine/execute.js index c8638d01a..7c5bc1ef8 100644 --- a/src/engine/execute.js +++ b/src/engine/execute.js @@ -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); diff --git a/src/engine/runtime.js b/src/engine/runtime.js index 3979b415e..47a4c75af 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -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); }