Skip to content

Commit

Permalink
Update Mist's Utils.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Mistium authored May 15, 2024
1 parent 2661f95 commit 3d5014e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions featured/Mist's Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@
B: { type: Scratch.ArgumentType.STRING, defaultValue: 'app' },
},
},
{
opcode: 'toUnicode',
func: 'err',
text: 'Unicode Of [A]',
blockType: Scratch.BlockType.REPORTER,
arguments: {
A: { type: Scratch.ArgumentType.STRING, defaultValue: 'A' },
},
},
],
};
}
Expand Down Expand Up @@ -287,6 +296,9 @@
const B_ends = descendTillSource.call(this, node.B, caseSanitize);
this.source += `\nvm.runtime.visualReport("${block.id}", ("" + (${A_ends})).endsWith("" + (${B_ends})));\n`;
return;
case 'mistsutils.toUnicode':
this.source += `\nvm.runtime.visualReport("${block.id}", ("" + (${descendTillSource.call(this, node.A, caseSanitize)})).codePointAt(0));\n`;
return;
default:
return originalFn(node);
}
Expand Down Expand Up @@ -343,6 +355,8 @@
const A_ends = descendTillSource.call(this, node.A, caseSanitize);
const B_ends = descendTillSource.call(this, node.B, caseSanitize);
return new TypedInput(`("" + (${A_ends})).endsWith("" + (${B_ends}))`, TYPE_BOOLEAN);
case "mistsutils.toUnicode":
return new TypedInput(`("" + (${descendTillSource.call(this, node.A, caseSanitize)})).codePointAt(0)`, TYPE_NUMBER);
default:
return originalFn(node);
}
Expand Down Expand Up @@ -440,6 +454,12 @@
A: this.descendInputOfBlock(block, 'A'),
B: this.descendInputOfBlock(block, 'B'),
};
case 'mistsutils_toUnicode':
return {
block,
kind: 'mistsutils.toUnicode',
A: this.descendInputOfBlock(block, 'A'),
};
default:
return originalFn(block);
}
Expand Down Expand Up @@ -530,6 +550,11 @@
A: this.descendInputOfBlock(block, 'A'),
B: this.descendInputOfBlock(block, 'B'),
};
case 'mistsutils_toUnicode':
return {
kind: 'mistsutils.toUnicode',
A: this.descendInputOfBlock(block, 'A'),
};
default:
return originalFn(block);
}
Expand Down

0 comments on commit 3d5014e

Please sign in to comment.