Skip to content

Commit

Permalink
Add custom hats to procedures category
Browse files Browse the repository at this point in the history
  • Loading branch information
LilyMakesThings authored Mar 5, 2024
1 parent 656b6d6 commit ef2985b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/procedures.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,11 @@ Blockly.Procedures.flyoutCategory = function(workspace) {
for (var i = 0; i < mutations.length; i++) {
var mutation = mutations[i].cloneNode(false);
var procCode = mutation.getAttribute('proccode');
var hat = Blockly.Procedures.getProcedureHat(procCode, workspace);
var returnType = Blockly.Procedures.getProcedureReturnType(procCode, workspace);
if (returnType !== Blockly.PROCEDURES_CALL_TYPE_STATEMENT) {
if (hat) {
mutation.setAttribute('hat', true);
} else if (returnType !== Blockly.PROCEDURES_CALL_TYPE_STATEMENT) {
mutation.setAttribute('return', returnType);
}
// <block type="procedures_call">
Expand Down Expand Up @@ -722,6 +725,7 @@ Blockly.Procedures.getBlockReturnType = function(block) {
}
}
}
// to do: array and object types?
if (hasSeenBooleanReturn) {
return Blockly.PROCEDURES_CALL_TYPE_BOOLEAN;
} else {
Expand Down

0 comments on commit ef2985b

Please sign in to comment.