Esempio n. 1
0
        /// <summary>
        /// Tests the and create implicit object.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="values">The values.</param>
        private void testAndCreateImplicitObject(MemoryCollectorNode node, HashSet <Value> values)
        {
            if (node.HasNewImplicitObject)
            {
                ObjectValue value = Snapshot.MemoryAssistant.CreateImplicitObject();
                values.Add(value);

                IObjectValueContainerBuilder objectValues = Structure.GetObjects(node.TargetIndex).Builder(Structure);
                objectValues.Add(value);
                Structure.SetObjects(node.TargetIndex, objectValues.Build(Structure));

                IObjectDescriptor        oldDescriptor = Structure.GetDescriptor(value);
                IObjectDescriptorBuilder builder       = oldDescriptor.Builder(Structure);

                foreach (var newChild in node.ImplicitObjectNode.UndefinedChildren)
                {
                    string childName = newChild.Item1;
                    MemoryCollectorNode childNode = newChild.Item2;

                    MemoryIndex index = ObjectIndex.Create(value, childName);
                    childNode.TargetIndex = index;

                    builder.AddIndex(childName, index);
                }

                IObjectDescriptor newDescriptor = builder.Build(Structure);
                Structure.SetDescriptor(value, newDescriptor);

                enqueueChildNodes(node.ImplicitObjectNode);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Processes the object.
        /// </summary>
        /// <param name="objectValue">The object value.</param>
        /// <param name="node">The node.</param>
        private void processObject(ObjectValue objectValue, ContainerCollectorNode node)
        {
            if (node.HasUndefinedChildren)
            {
                IObjectDescriptor        oldDescriptor = Structure.GetDescriptor(objectValue);
                IObjectDescriptorBuilder builder       = oldDescriptor.Builder(Structure);
                foreach (var newChild in node.UndefinedChildren)
                {
                    string childName = newChild.Item1;
                    MemoryCollectorNode childNode = newChild.Item2;

                    MemoryIndex index = ObjectIndex.Create(objectValue, childName);
                    childNode.TargetIndex = index;

                    builder.AddIndex(childName, index);
                }

                IObjectDescriptor newDescriptor = builder.Build(Structure);
                Structure.SetDescriptor(objectValue, newDescriptor);
            }
            enqueueChildNodes(node);
        }