mirror of
https://github.com/scratchfoundation/scratch-flash.git
synced 2024-12-04 21:21:06 -05:00
Fixed incorrect caching in primVarSet and primVarChange
This commit is contained in:
parent
9be7d2e86e
commit
f68a2fa134
1 changed files with 6 additions and 4 deletions
|
@ -664,9 +664,10 @@ public class Interpreter {
|
|||
}
|
||||
|
||||
protected function primVarSet(b:Block):Variable {
|
||||
var v:Variable = activeThread.target.varCache[arg(b, 0)];
|
||||
var name:String = arg(b, 0);
|
||||
var v:Variable = activeThread.target.varCache[name];
|
||||
if (!v) {
|
||||
v = activeThread.target.varCache[b.spec] = activeThread.target.lookupOrCreateVar(arg(b, 0));
|
||||
v = activeThread.target.varCache[name] = activeThread.target.lookupOrCreateVar(name);
|
||||
if (!v) return null;
|
||||
}
|
||||
var oldvalue:* = v.value;
|
||||
|
@ -675,9 +676,10 @@ public class Interpreter {
|
|||
}
|
||||
|
||||
protected function primVarChange(b:Block):Variable {
|
||||
var v:Variable = activeThread.target.varCache[arg(b, 0)];
|
||||
var name:String = arg(b, 0);
|
||||
var v:Variable = activeThread.target.varCache[name];
|
||||
if (!v) {
|
||||
v = activeThread.target.varCache[b.spec] = activeThread.target.lookupOrCreateVar(arg(b, 0));
|
||||
v = activeThread.target.varCache[name] = activeThread.target.lookupOrCreateVar(name);
|
||||
if (!v) return null;
|
||||
}
|
||||
v.value = Number(v.value) + numarg(b, 1);
|
||||
|
|
Loading…
Reference in a new issue