Skip to content

Commit

Permalink
fixed evaluating special strings inside numerical input slots
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoenig committed Jan 25, 2025
1 parent 058b468 commit 5e565d1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
8 changes: 8 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## in development:

## 10.4.5:
* **Notable Fixes:**
* fixed evaluating special strings inside numerical input slots

### 2025-01-25
* blocks: fixed evaluating special strings inside numerical input slots
* prepared v10.4.5 patch

## 10.4.4:
* **Notable Fixes:**
* fixed alphanumeric input slot evaluation for list accessors
Expand Down
4 changes: 2 additions & 2 deletions snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
<script src="src/morphic.js?version=2025-01-21"></script>
<script src="src/symbols.js?version=2024-11-24"></script>
<script src="src/widgets.js?version=2024-07-24"></script>
<script src="src/blocks.js?version=2025-01-24-2"></script>
<script src="src/blocks.js?version=2025-01-25"></script>
<script src="src/threads.js?version=2025-01-24"></script>
<script src="src/objects.js?version=2025-01-24"></script>
<script src="src/scenes.js?version=2024-05-28"></script>
<script src="src/gui.js?version=2025-01-24-2"></script>
<script src="src/gui.js?version=2025-01-25"></script>
<script src="src/paint.js?version=2023-05-24"></script>
<script src="src/lists.js?version=2025-01-07"></script>
<script src="src/byob.js?version=2024-12-18"></script>
Expand Down
14 changes: 10 additions & 4 deletions src/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ CustomHatBlockMorph*/

// Global stuff ////////////////////////////////////////////////////////

modules.blocks = '2025-January-24';
modules.blocks = '2025-January-25';

var SyntaxElementMorph;
var BlockMorph;
Expand Down Expand Up @@ -12334,8 +12334,11 @@ InputSlotMorph.prototype.mappedCode = function () {

InputSlotMorph.prototype.evaluate = function () {
// answer my contents, which can be a "wish", i.e. a block that refers to
// another sprite's local method, or a text string.
var val;
// another sprite's local method, or a text string. If I am numerical
// convert that string to a number. If the conversion fails answer the
// string (e.g. for special choices like 'random', 'all' or 'last')
// otherwise the numerical value.
var val, num;
if (this.selectedBlock) {
return this.selectedBlock;
}
Expand All @@ -12353,7 +12356,10 @@ InputSlotMorph.prototype.evaluate = function () {
!this.isAlphanumeric &&
(!this.evaluateAsString || val === '')
) {
return +val;
num = +val;
if (!isNaN(num)) {
return num;
}
}
return val;
};
Expand Down
4 changes: 2 additions & 2 deletions src/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ HatBlockMorph*/

// Global stuff ////////////////////////////////////////////////////////

modules.gui = '2025-January-24';
modules.gui = '2025-January-25';

// Declarations

var SnapVersion = '10.4.4';
var SnapVersion = '10.4.5';

var IDE_Morph;
var ProjectDialogMorph;
Expand Down
2 changes: 1 addition & 1 deletion sw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*global self, caches*/
/*jshint esversion: 6*/
var snapVersion = '10.4.4',
var snapVersion = '10.4.5',
cacheName = `snap-pwa-${snapVersion}`,
filesToCache = [
'snap.html',
Expand Down

0 comments on commit 5e565d1

Please sign in to comment.