Fixed incorrect caching in primVarSet and primVarChange

This commit is contained in:
Nathan Dinsmore 2014-05-11 15:45:26 -04:00
parent 9be7d2e86e
commit f68a2fa134

View file

@ -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);