Ejemplo n.º 1
0
 public static TypeMirror GetType(ArrayMirror parent, int key)
 {
     return parent.Type.GetElementType();
 }
Ejemplo n.º 2
0
        private static int DoGetArrayLength(ArrayMirror parent, int dimension)
        {
            int length = 1;

            for (int dim = dimension + 1; dim < parent.Rank; ++dim)
            {
                length *= parent.GetLength(dim);
            }

            return length;
        }
Ejemplo n.º 3
0
 public static VariableItem GetChild(ThreadMirror thread, VariableItem parentItem, ArrayMirror parent, int index)
 {
     string name = GetArrayName(parent, index);
     Value child = parent[index];
     return new VariableItem(thread, name, parentItem, index, child, index);
 }
Ejemplo n.º 4
0
        internal static string GetArrayName(ArrayMirror parent, int i)
        {
            var builder = new System.Text.StringBuilder();

            builder.Append('[');
            for (int dim = 0; dim < parent.Rank; ++dim)
            {
                int length = DoGetArrayLength(parent, dim);
                int index;
                if (dim < parent.Rank - 1)
                {
                    index = i/length;
                    i = i - length*index;
                }
                else
                {
                    index = i;
                }

                builder.Append((index + parent.GetLowerBound(dim)).ToString());
                if (dim + 1 < parent.Rank)
                    builder.Append(", ");
            }
            builder.Append(']');

            return builder.ToString();
        }
Ejemplo n.º 5
0
 public static void Set(ThreadMirror thread, VariableItem item, ArrayMirror parent, int key, Value newValue)
 {
     parent.SetValues(key, new Value[]{newValue});
 }
Ejemplo n.º 6
0
        private void DoWalkArray(ArrayMirror value, Trace parent, string name)
        {
            if (!value.IsCollected && !m_objects.Contains(value.Address))
            {
                m_objects.Add(value.Address);
                if (value.Length > 0 &&  DoShouldWalkType(value.Type.GetElementType()))		// there's no need to walk arrays of primitives and they can be very large
                {
                    for (int i = 0; i < value.Length; ++i)
                    {
                        string temp = string.Format("{0}[{1}]", name, i);
                        Log.WriteLine(TraceLevel.Verbose, "TraceRoots", temp);

                        var child = new Trace(temp, value.Type.FullName, value[i]);
                        DoWalkValue(value[i], child, temp);
                        if (child.Children.Count > 0)
                            parent.Children.Add(child);
                    }
                }
            }
        }
		public ArrayAdaptor (ArrayMirror array)
		{
			this.array = array;
		}
Ejemplo n.º 8
0
			public SimpleEnumerator (ArrayMirror arr)
			{
				this.arr = arr;
				this.pos = -1;
				this.length = arr.Length;
			}