Update JintJavaScriptEvaluator.cs

This commit is contained in:
Sipke Schoorstra 2022-06-04 20:21:29 +02:00
parent 429f65b88b
commit 17f7e4d58d

View file

@ -66,21 +66,21 @@ namespace Elsa.JavaScript.Implementations
private IDictionary<string, MemoryBlock> GetVariables(ExpressionExecutionContext context)
{
var currentContext = context;
var dictionary = new Dictionary<string, MemoryBlock>();
var currentRegister = context.Memory;
var memoryBlocks = new Dictionary<string, MemoryBlock>();
while (currentContext != null)
while (currentRegister != null)
{
foreach (var l in currentContext.Memory.Blocks)
foreach (var l in currentRegister.Blocks)
{
if(!dictionary.ContainsKey(l.Key))
dictionary.Add(l.Key, l.Value);
if(!memoryBlocks.ContainsKey(l.Key))
memoryBlocks.Add(l.Key, l.Value);
}
currentContext = currentContext.ParentContext;
currentRegister = currentRegister.Parent;
}
return dictionary;
return memoryBlocks;
}
}
}