/// <summary> /// Gets the stack level for ven index. Finds existing call level or creates new one /// if is missing. /// </summary> /// <param name="index">The index.</param> /// <returns>The stack level for the given index.</returns> private MemoryIndexTreeStackContext getStackLevel(MemoryIndex index) { MemoryIndexTreeStackContext stack = null; if (!memoryStack.TryGetValue(index.CallLevel, out stack)) { stack = new MemoryIndexTreeStackContext(); memoryStack[index.CallLevel] = stack; } return(stack); }
/// <inheritdoc /> public void VisitControlIndex(ControlIndex index) { MemoryIndexTreeStackContext stackContext = getStackLevel(index); if (index.MemoryRoot.IsAny) { addToRoot(index, stackContext.ControlsTreeRoot.GetOrCreateAny()); } else { addToRoot(index, stackContext.ControlsTreeRoot.GetOrCreateChild(index.MemoryRoot.Name)); } }
/// <inheritdoc /> public void VisitTemporaryIndex(TemporaryIndex index) { MemoryIndexTreeStackContext stackContext = getStackLevel(index); addToRoot(index, stackContext.TemporaryTreeRoot); }