Lock Variables while adding to it to prevent threading issues
This commit is contained in:
@@ -40,17 +40,20 @@ namespace Upsilon.Evaluator
|
|||||||
|
|
||||||
public void AssignToNearest(VariableSymbol symbol, ScriptType value)
|
public void AssignToNearest(VariableSymbol symbol, ScriptType value)
|
||||||
{
|
{
|
||||||
if (Variables.ContainsKey(symbol.Name))
|
lock (Variables)
|
||||||
{
|
{
|
||||||
Variables[symbol.Name] = value;
|
if (Variables.ContainsKey(symbol.Name))
|
||||||
}
|
{
|
||||||
else if (ParentScope != null)
|
Variables[symbol.Name] = value;
|
||||||
{
|
}
|
||||||
ParentScope.AssignToNearest(symbol, value);
|
else if (ParentScope != null)
|
||||||
}
|
{
|
||||||
else
|
ParentScope.AssignToNearest(symbol, value);
|
||||||
{
|
}
|
||||||
Variables.Add(symbol.Name, value);
|
else
|
||||||
|
{
|
||||||
|
Variables.Add(symbol.Name, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user