diff --git a/HISTORY.md b/HISTORY.md
index 131114a4c..b7252d7f9 100755
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -6,6 +6,11 @@
* new "input slots" menu option for custom block input slots
* **Notable Changes:**
* automatically add a dropdown menu to any custom block input slot whose definition has a slot menu event hat block for it
+* **Notable Fixes:**
+ * fixed input names when querying a custom block definition that has no function body script
+
+### 2024-11-12
+* threads: fixed input names when querying a custom block definition that has no function body script
### 2024-11-11
* threads: expose a copy of the custom block as "caller" to input slot reaction scripts inside custom block definitions
diff --git a/snap.html b/snap.html
index 738209ea0..7e682233e 100755
--- a/snap.html
+++ b/snap.html
@@ -17,7 +17,7 @@
-
+
diff --git a/src/threads.js b/src/threads.js
index 5a889b90f..13bb01ffa 100644
--- a/src/threads.js
+++ b/src/threads.js
@@ -65,7 +65,7 @@ StagePickerMorph, CustomBlockDefinition, CommentMorph, BooleanSlotMorph*/
/*jshint esversion: 11, bitwise: false, evil: true*/
-modules.threads = '2024-November-11';
+modules.threads = '2024-November-12';
var ThreadManager;
var Process;
@@ -7972,19 +7972,24 @@ Process.prototype.reportBasicBlockAttribute = function (attribute, block) {
case 'definition':
if (expr.isCustomBlock) {
if (expr.isGlobal) {
- if (expr.definition.primitive && !expr.definition.body) {
+ def = expr.definition;
+ if (def.primitive && !def.body) {
prim = SpriteMorph.prototype.blockForSelector(
'doPrimitive'
);
prim.inputs()[0].setContents(true);
- prim.inputs()[1].setContents(expr.definition.primitive);
+ prim.inputs()[1].setContents(def.primitive);
body = prim.reify();
- } else {
- body = expr.definition.body || new Context();
}
} else {
- body = this.blockReceiver().getMethod(expr.semanticSpec).body ||
- new Context();
+ def = this.blockReceiver().getMethod(expr.semanticSpec);
+ }
+ if (!body) {
+ body = def.body;
+ if (!body) {
+ body = new Context();
+ def.inputNames().forEach(name => body.addInput(name));
+ }
}
} else {
prim = SpriteMorph.prototype.blocks[expr.selector].src;
@@ -7997,14 +8002,14 @@ Process.prototype.reportBasicBlockAttribute = function (attribute, block) {
prim.inputs()[1].setContents(expr.selector);
body = prim.reify();
}
- }
- if (body instanceof Context &&
- (!body.expression || prim) &&
- !body.inputs.length
- ) {
- // make sure the definition has the same number of inputs as the
- // block prototype (i.e. the header)
- expr.inputs().forEach((inp, i) => body.addInput('#' + (i + 1)));
+ if (body instanceof Context &&
+ (!body.expression || prim) &&
+ !body.inputs.length
+ ) {
+ // make sure the definition has the same number of inputs as the
+ // block prototype (i.e. the header)
+ expr.inputs().forEach((inp, i) => body.addInput('#' + (i + 1)));
+ }
}
if (body.expression && body.expression.selector === 'doReport' &&
body.expression.inputs()[0] instanceof BlockMorph) {