From 387cdca5ab83f5e1015dba7e89692e28893dfd4d Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 10 Jun 2020 12:22:48 +0200 Subject: [PATCH] shadow special lists (costumes, sounds) when adding an element to them --- snap.html | 2 +- src/threads.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/snap.html b/snap.html index b696446d..435702b3 100755 --- a/snap.html +++ b/snap.html @@ -8,7 +8,7 @@ - + diff --git a/src/threads.js b/src/threads.js index 6ce1aa8f..86c169a7 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, Color, TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/ -modules.threads = '2020-June-07'; +modules.threads = '2020-June-10'; var ThreadManager; var Process; @@ -1755,9 +1755,19 @@ Process.prototype.reportCDR = function (list) { }; Process.prototype.doAddToList = function (element, list) { + var rcvr; this.assertType(list, 'list'); if (list.type) { this.assertType(element, list.type); + // check whether the list is an attribute that needs to be shadowed + rcvr = this.blockReceiver(); + if (this.reportIsIdentical(list, rcvr.costumes)) { + rcvr.shadowAttribute('costumes'); + list = rcvr.costumes; + } else if (this.reportIsIdentical(list, rcvr.sounds)) { + rcvr.shadowAttribute('sounds'); + list = rcvr.sounds; + } } list.add(element); };