allow upvars to be SET and CHANGEd
pull/3/merge
jmoenig 2014-09-22 15:21:56 +02:00
rodzic 5695dd141b
commit 5605df3dd5
2 zmienionych plików z 24 dodań i 25 usunięć

Wyświetl plik

@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2014-August-13';
modules.blocks = '2014-September-22';
var SyntaxElementMorph;
@ -6755,9 +6755,6 @@ InputSlotMorph.prototype.soundsMenu = function () {
InputSlotMorph.prototype.getVarNamesDict = function () {
var block = this.parentThatIsA(BlockMorph),
rcvr,
proto,
rings,
declarations,
tempVars = [],
dict;
@ -6765,28 +6762,26 @@ InputSlotMorph.prototype.getVarNamesDict = function () {
return {};
}
rcvr = block.receiver();
proto = detect(block.allParents(), function (morph) {
return morph instanceof PrototypeHatBlockMorph;
block.allParents().forEach(function (morph) {
if (morph instanceof PrototypeHatBlockMorph) {
tempVars.push.apply(
tempVars,
morph.inputs()[0].inputFragmentNames()
);
} else if (morph instanceof BlockMorph) {
morph.inputs().forEach(function (inp) {
if (inp instanceof TemplateSlotMorph) {
tempVars.push(inp.contents());
} else if (inp instanceof MultiArgMorph) {
inp.children.forEach(function (m) {
if (m instanceof TemplateSlotMorph) {
tempVars.push(m.contents());
}
});
}
});
}
});
if (proto) {
tempVars = proto.inputs()[0].inputFragmentNames();
}
rings = block.allParents().filter(function (block) {
return block instanceof RingMorph;
});
rings.forEach(function (block) {
tempVars = tempVars.concat(block.inputs()[1].evaluate());
});
declarations = block.allParents().filter(function (block) {
return block.selector === 'doDeclareVariables';
});
declarations.forEach(function (block) {
tempVars = tempVars.concat(block.inputs()[0].evaluate());
});
if (rcvr) {
dict = rcvr.variables.allNamesDict();
tempVars.forEach(function (name) {

Wyświetl plik

@ -2270,3 +2270,7 @@ ______
140918
------
* Threads: fixed #174, replace UpvarReferences with references to Variable objects, fixes upvar scope issues
140922
------
* Blocks: Make upvars mutable