Fix variable conflicts that arise when sharing the love of a sprite-local variable with the stage.

This commit is contained in:
Karishma Chadha 2018-07-09 10:44:45 -04:00
parent c69a59575d
commit 406e59fc18
2 changed files with 64 additions and 2 deletions
src/engine

View file

@ -693,12 +693,15 @@ class Blocks {
/**
* Returns a map of all references to variables or lists from blocks
* in this block container.
* @param {Array<object>} optBlocks Optional list of blocks to constrain the search to.
* This is useful for getting variable/list references for a stack of blocks instead
* of all blocks on the workspace
* @return {object} A map of variable ID to a list of all variable references
* for that ID. A variable reference contains the field referencing that variable
* and also the type of the variable being referenced.
*/
getAllVariableAndListReferences () {
const blocks = this._blocks;
getAllVariableAndListReferences (optBlocks) {
const blocks = optBlocks ? optBlocks : this._blocks;
const allReferences = Object.create(null);
for (const blockId in blocks) {
let varOrListField = null;