From b0416642057403a911e7e71346e92da5a840619d Mon Sep 17 00:00:00 2001 From: jmoenig Date: Sun, 9 Sep 2018 15:50:54 +0200 Subject: [PATCH] fixed #2176 'arguments' not found for calling empty multi-slots --- history.txt | 1 + snap.html | 2 +- threads.js | 26 +++++++++++++++----------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/history.txt b/history.txt index fb5dd602..28b36703 100755 --- a/history.txt +++ b/history.txt @@ -4305,3 +4305,4 @@ Fixes: 180909 ------ * new dev version +* Threads: fixed #2176 ('arguments' not found for calling empty multi-slots) diff --git a/snap.html b/snap.html index 846141cc..83f3624b 100755 --- a/snap.html +++ b/snap.html @@ -7,7 +7,7 @@ - + diff --git a/threads.js b/threads.js index a090a20b..16652a12 100644 --- a/threads.js +++ b/threads.js @@ -62,7 +62,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, TableFrameMorph, ColorSlotMorph, isSnapObject*/ -modules.threads = '2018-July-19'; +modules.threads = '2018-September-09'; var ThreadManager; var Process; @@ -1117,7 +1117,13 @@ Process.prototype.evaluate = function ( this.readyToYield = (Date.now() - this.lastYield > this.timeout); } - // assign parameters if any were passed + // assign arguments to parameters + + // assign the actual arguments list to the special + // parameter ID ['arguments'], to be used for variadic inputs + outer.variables.addVar(['arguments'], args); + + // assign arguments that are actually passed if (parms.length > 0) { // assign formal parameters @@ -1131,10 +1137,6 @@ Process.prototype.evaluate = function ( // assign implicit parameters if there are no formal ones if (context.inputs.length === 0) { - // assign the actual arguments list to the special - // parameter ID ['arguments'], to be used for variadic inputs - outer.variables.addVar(['arguments'], args); - // in case there is only one input // assign it to all empty slots if (parms.length === 1) { @@ -1215,7 +1217,13 @@ Process.prototype.initializeFor = function (context, args) { // remember the receiver this.context = context.receiver; - // assign parameters if any were passed + // assign arguments to parameters + + // assign the actual arguments list to the special + // parameter ID ['arguments'], to be used for variadic inputs + outer.variables.addVar(['arguments'], args); + + // assign arguments that are actually passed if (parms.length > 0) { // assign formal parameters @@ -1229,10 +1237,6 @@ Process.prototype.initializeFor = function (context, args) { // assign implicit parameters if there are no formal ones if (context.inputs.length === 0) { - // assign the actual arguments list to the special - // parameter ID ['arguments'], to be used for variadic inputs - outer.variables.addVar(['arguments'], args); - // in case there is only one input // assign it to all empty slots if (parms.length === 1) {