Skip to content

Commit

Permalink
fixed a variable scope bug when evaluating a ring with a same-named f…
Browse files Browse the repository at this point in the history
…ormal parameter as an outer scoped variable
  • Loading branch information
jmoenig committed Aug 5, 2024
1 parent 3af0178 commit b18f5b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Snap! (BYOB) History

## in development:
* **Notable Fixes:**
* fixed a variable scope bug when evaluating a ring with a same-named formal parameter as an outer scoped variable

### 2024-08-05
* new dev version
* threads: fixed a variable scope bug when evaluating a ring with a same-named formal parameter as an outer scoped variable

## 10.0.0:
* **New Features:**
Expand Down
2 changes: 1 addition & 1 deletion snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="src/symbols.js?version=2024-01-24"></script>
<script src="src/widgets.js?version=2024-07-24"></script>
<script src="src/blocks.js?version=2024-06-10"></script>
<script src="src/threads.js?version=2024-06-10"></script>
<script src="src/threads.js?version=2024-08-05"></script>
<script src="src/objects.js?version=2024-07-11"></script>
<script src="src/scenes.js?version=2024-05-28"></script>
<script src="src/gui.js?version=2024-08-05"></script>
Expand Down
8 changes: 5 additions & 3 deletions src/threads.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ StagePickerMorph, CustomBlockDefinition, CommentMorph*/

/*jshint esversion: 11, bitwise: false, evil: true*/

modules.threads = '2024-June-10';
modules.threads = '2024-August-05';

var ThreadManager;
var Process;
Expand Down Expand Up @@ -1034,8 +1034,10 @@ Process.prototype.evaluateMultiSlot = function (multiSlot, argCount) {
this.evaluateNextInputSet(multiSlot); // frame-optimized version
} else {
// declare a new script var in the current context for every
// variable template
if (multiSlot.slotSpec === '%t') { // variable template
// variable template, excluding formal ring parameters
if (multiSlot.slotSpec === '%t' && // variable template
!(multiSlot.parentThatIsA(BlockMorph) instanceof RingMorph)
) {
inputs.forEach(vname =>
this.context.outerContext.variables.addVar(vname)
);
Expand Down

0 comments on commit b18f5b9

Please sign in to comment.