public MemoryIndexTest() { Snapshot snapshot = new Snapshot(); snapshot.StartTransaction(); ObjectValue object1 = snapshot.CreateObject(null); ObjectValue object2 = snapshot.CreateObject(null); snapshot.CommitTransaction(); variableA = VariableIndex.Create("a", 0); variableA2 = VariableIndex.Create("a", 0); variableB = VariableIndex.Create("b", 0); undefinedVariable = VariableIndex.CreateUnknown(0); fieldA = ObjectIndex.Create(object1, "a"); fieldA2 = ObjectIndex.Create(object1, "a"); fieldB = ObjectIndex.Create(object1, "b"); fieldInDifferentTree = ObjectIndex.Create(object2, "a"); undefinedField = ObjectIndex.CreateUnknown(object1); indexA = variableA.CreateIndex("a"); indexA2 = variableA.CreateIndex("a"); indexB = variableA.CreateIndex("b"); indexInDifferentTree = variableB.CreateIndex("a"); undefinedIndex = variableA.CreateUnknownIndex(); doubleIndex = indexA.CreateIndex("1"); indexInField = fieldA.CreateIndex("1"); }
public void VisitVariableIndex(VariableIndex index) { currentNode = rootNode.GetOrCreateVariableStackNode(collector, index.CallLevel); processIndexName(index); processIndexPath(index); processAlias(index); }
/// <inheritdoc /> public override void AddLocalLevel() { CopyStackContext context = new CopyStackContext(localLevel); context.WriteableVariables.SetUnknownIndex(VariableIndex.CreateUnknown(localLevel)); context.WriteableControllVariables.SetUnknownIndex(ControlIndex.CreateUnknown(localLevel)); memoryStack.Add(context); localLevel++; }
/// <inheritdoc /> public override void AddStackLevel(int level) { IWriteableStackContext context = Factories.StructuralContainersFactories.StackContextFactory.CreateWriteableStackContext(level); context.WriteableVariables.SetUnknownIndex(VariableIndex.CreateUnknown(level)); context.WriteableControllVariables.SetUnknownIndex(ControlIndex.CreateUnknown(level)); NewIndex(context.WriteableVariables.UnknownIndex); NewIndex(context.WriteableControllVariables.UnknownIndex); memoryStack.Add(level, context); }
/// <inheritdoc /> public void VisitVariableIndex(VariableIndex index) { MemoryIndexTreeStackContext stackContext = getStackLevel(index); if (index.MemoryRoot.IsAny) { addToRoot(index, stackContext.VariablesTreeRoot.GetOrCreateAny()); } else { addToRoot(index, stackContext.VariablesTreeRoot.GetOrCreateChild(index.MemoryRoot.Name)); } }
/// <summary> /// Processes the variables. /// </summary> /// <param name="stackLevel">The stack level.</param> /// <param name="node">The node.</param> private void processVariables(int stackLevel, CollectorNode node) { if (node.HasUndefinedChildren) { IWriteableIndexContainer writeableVariableContainer = Structure.GetWriteableStackContext(stackLevel).WriteableVariables; foreach (var newChild in node.UndefinedChildren) { string childName = newChild.Item1; MemoryCollectorNode childNode = newChild.Item2; MemoryIndex index = VariableIndex.Create(childName, stackLevel); childNode.TargetIndex = index; writeableVariableContainer.AddIndex(childName, index); } } enqueueChildNodes(node); }
/// <inheritdoc /> public MemoryIndex createMemoryIndex(string name) { return(VariableIndex.Create(name, stackLevel)); }