From f68a2fa134dcd051dd860ff3f3ba59b21661cf44 Mon Sep 17 00:00:00 2001 From: Nathan Dinsmore Date: Sun, 11 May 2014 15:45:26 -0400 Subject: [PATCH] Fixed incorrect caching in primVarSet and primVarChange --- src/interpreter/Interpreter.as | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/interpreter/Interpreter.as b/src/interpreter/Interpreter.as index 88e380d..45b487b 100644 --- a/src/interpreter/Interpreter.as +++ b/src/interpreter/Interpreter.as @@ -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);