From 7434e8f8782f098247b0ebab5f0187adacc351e8 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Sat, 1 Aug 2020 09:35:49 +0200 Subject: [PATCH] fixed variable scope for ASK/TELL --- HISTORY.md | 6 ++++++ snap.html | 6 +++--- src/gui.js | 4 ++-- src/threads.js | 20 +++++++++----------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 87ca04d4..0e299a19 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,12 @@ ## in development: +## 6.1.2: +* fixed variable scope for ASK/TELL + +### 2020-08-01 +* threads: fixed variable scope for ASK/TELL + ## 6.1.1: * rolled back scope binding change diff --git a/snap.html b/snap.html index adbed025..0231c04b 100755 --- a/snap.html +++ b/snap.html @@ -2,15 +2,15 @@ - Snap! Build Your Own Blocks 6.1.1 + Snap! Build Your Own Blocks 6.1.2 - + - + diff --git a/src/gui.js b/src/gui.js index 33ab551d..b7e08cd7 100644 --- a/src/gui.js +++ b/src/gui.js @@ -78,7 +78,7 @@ Animation, BoxMorph, BlockEditorMorph, BlockDialogMorph, Note, ZERO, BLACK*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2020-July-31'; +modules.gui = '2020-August-01'; // Declarations @@ -3971,7 +3971,7 @@ IDE_Morph.prototype.aboutSnap = function () { module, btn1, btn2, btn3, btn4, licenseBtn, translatorsBtn, world = this.world(); - aboutTxt = 'Snap! 6.1.1\nBuild Your Own Blocks\n\n' + aboutTxt = 'Snap! 6.1.2\nBuild Your Own Blocks\n\n' + 'Copyright \u24B8 2008-2020 Jens M\u00F6nig and ' + 'Brian Harvey\n' + 'jens@moenig.org, bh@cs.berkeley.edu\n\n' diff --git a/src/threads.js b/src/threads.js index c9316341..a70b8958 100644 --- a/src/threads.js +++ b/src/threads.js @@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map, isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK, TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/ -modules.threads = '2020-July-31'; +modules.threads = '2020-August-01'; var ThreadManager; var Process; @@ -5031,22 +5031,20 @@ Process.prototype.doSet = function (attribute, value) { Process.prototype.reportContextFor = function (context, otherObj) { // Private - return a copy of the context // and bind it to another receiver - var result = copy(context); + var result = copy(context), + receiverVars, + rootVars; + result.receiver = otherObj; if (result.outerContext) { result.outerContext = copy(result.outerContext); result.outerContext.variables = copy(result.outerContext.variables); result.outerContext.receiver = otherObj; - - // under investigation - // the following code should be replaced by - // result.outerContext.variables.parentFrame = otherObj.variables; - if (result.outerContext.variables.parentFrame) { - result.outerContext.variables.parentFrame = - copy(result.outerContext.variables.parentFrame); - result.outerContext.variables.parentFrame.parentFrame = - otherObj.variables; + rootVars = result.outerContext.variables.parentFrame; + receiverVars = copy(otherObj.variables); + receiverVars.parentFrame = rootVars; + result.outerContext.variables.parentFrame = receiverVars; } else { result.outerContext.variables.parentFrame = otherObj.variables; }