public void Remove(ArrayDimension value) { if (OnArrayDimensionRemoved != null && this.Contains(value)) { OnArrayDimensionRemoved(this, new ArrayDimensionEventArgs(value)); } m_items.Remove(value); }
public void Insert(int index, ArrayDimension value) { if (OnArrayDimensionAdded != null && !this.Contains(value)) { OnArrayDimensionAdded(this, new ArrayDimensionEventArgs(value)); } m_items.Insert(index, value); }
public void Add(ArrayDimension value) { if (OnArrayDimensionAdded != null && !this.Contains(value)) { OnArrayDimensionAdded(this, new ArrayDimensionEventArgs(value)); } m_items.Add(value); }
public ArrayType(TypeReference type, int rank) : this(type) { Mixin.CheckType(type); if (rank != 1) { this.dimensions = new Collection <ArrayDimension>(rank); for (int i = 0; i < rank; i++) { ArrayDimension item = new ArrayDimension(); this.dimensions.Add(item); } base.etype = ElementType.Array; } }
private void WriteArrayTypeSignature(ArrayType array) { this.WriteElementType(ElementType.Array); this.WriteTypeSignature(array.ElementType); Collection <ArrayDimension> dimensions = array.Dimensions; int count = dimensions.Count; base.WriteCompressedUInt32((uint)count); int num = 0; int num1 = 0; for (int i = 0; i < count; i++) { ArrayDimension item = dimensions[i]; if (item.UpperBound.HasValue) { num++; num1++; } else if (item.LowerBound.HasValue) { num1++; } } int[] value = new int[num]; int[] valueOrDefault = new int[num1]; for (int j = 0; j < num1; j++) { ArrayDimension arrayDimension = dimensions[j]; int? lowerBound = arrayDimension.LowerBound; valueOrDefault[j] = lowerBound.GetValueOrDefault(); if (arrayDimension.UpperBound.HasValue) { lowerBound = arrayDimension.UpperBound; value[j] = lowerBound.Value - valueOrDefault[j] + 1; } } base.WriteCompressedUInt32((uint)num); for (int k = 0; k < num; k++) { base.WriteCompressedUInt32((uint)value[k]); } base.WriteCompressedUInt32((uint)num1); for (int l = 0; l < num1; l++) { base.WriteCompressedInt32(valueOrDefault[l]); } }
private void WriteArrayTypeSignature(ArrayType array) { this.WriteElementType(ElementType.Array); this.WriteTypeSignature(array.ElementType); Collection <ArrayDimension> dimensions = array.Dimensions; int count = dimensions.Count; base.WriteCompressedUInt32((uint)count); int num2 = 0; int num3 = 0; for (int i = 0; i < count; i++) { ArrayDimension dimension = dimensions[i]; if (dimension.UpperBound != null) { num2++; num3++; } else if (dimension.LowerBound != null) { num3++; } } int[] numArray = new int[num2]; int[] numArray2 = new int[num3]; for (int j = 0; j < num3; j++) { ArrayDimension dimension2 = dimensions[j]; numArray2[j] = dimension2.LowerBound.GetValueOrDefault(); if (dimension2.UpperBound != null) { numArray[j] = (dimension2.UpperBound.Value - numArray2[j]) + 1; } } base.WriteCompressedUInt32((uint)num2); for (int k = 0; k < num2; k++) { base.WriteCompressedUInt32((uint)numArray[k]); } base.WriteCompressedUInt32((uint)num3); for (int m = 0; m < num3; m++) { base.WriteCompressedInt32(numArray2[m]); } }
private static TypeReference CreateSpecs(TypeReference type, Type type_info) { type = TryCreateGenericInstanceType(type, type_info); int[] specs = type_info.specs; if (!specs.IsNullOrEmpty <int>()) { for (int i = 0; i < specs.Length; i++) { int num3 = specs[i]; switch (num3) { case -3: type = new ArrayType(type); break; case -2: type = new ByReferenceType(type); break; case -1: type = new PointerType(type); break; default: { ArrayType type2 = new ArrayType(type); type2.Dimensions.Clear(); int num2 = 0; while (true) { if (num2 >= specs[i]) { type = type2; break; } ArrayDimension item = new ArrayDimension(); type2.Dimensions.Add(item); num2++; } break; } } } } return(type); }
private void WriteArrayTypeSignature(ArrayType array) { WriteElementType(ElementType.Array); WriteTypeSignature(array.ElementType); Collection <ArrayDimension> dimensions = array.Dimensions; int count = dimensions.Count; base.WriteCompressedUInt32((uint)count); int num = 0; int num2 = 0; for (int i = 0; i < count; i++) { ArrayDimension arrayDimension = dimensions[i]; if (arrayDimension.UpperBound.HasValue) { num++; num2++; } else if (arrayDimension.LowerBound.HasValue) { num2++; } } int[] array2 = new int[num]; int[] array3 = new int[num2]; for (int j = 0; j < num2; j++) { ArrayDimension arrayDimension2 = dimensions[j]; array3[j] = arrayDimension2.LowerBound.GetValueOrDefault(); if (arrayDimension2.UpperBound.HasValue) { array2[j] = arrayDimension2.UpperBound.Value - array3[j] + 1; } } base.WriteCompressedUInt32((uint)num); for (int k = 0; k < num; k++) { base.WriteCompressedUInt32((uint)array2[k]); } base.WriteCompressedUInt32((uint)num2); for (int l = 0; l < num2; l++) { base.WriteCompressedInt32(array3[l]); } }
string Suffix() { StringBuilder sb = new StringBuilder(); sb.Append("["); for (int i = 0; i < m_dimensions.Count; i++) { ArrayDimension dim = m_dimensions [i]; string rank = dim.ToString(); if (i < m_dimensions.Count - 1) { sb.Append(","); } if (rank.Length > 0) { sb.Append(" "); sb.Append(rank); } } sb.Append("]"); return(sb.ToString()); }
static bool compareArrayDimensions(ArrayDimension a, ArrayDimension b) { return a.LowerBound == b.LowerBound && a.UpperBound == b.UpperBound; }
public bool Contains(ArrayDimension value) { return(m_items.Contains(value)); }
static int arrayDimensionHashCode(ArrayDimension a) { return a.LowerBound.GetHashCode() + a.UpperBound.GetHashCode(); }
private TypeReference ImportTypeSpecification(TypeReference type, ImportGenericContext context) { switch (type.etype) { case ElementType.SzArray: { ArrayType arrayType = (ArrayType)type; return(new ArrayType(ImportType(arrayType.ElementType, context))); } case ElementType.Ptr: { PointerType pointerType = (PointerType)type; return(new PointerType(ImportType(pointerType.ElementType, context))); } case ElementType.ByRef: { ByReferenceType byReferenceType = (ByReferenceType)type; return(new ByReferenceType(ImportType(byReferenceType.ElementType, context))); } case ElementType.Pinned: { PinnedType pinnedType = (PinnedType)type; return(new PinnedType(ImportType(pinnedType.ElementType, context))); } case ElementType.Sentinel: { SentinelType sentinelType = (SentinelType)type; return(new SentinelType(ImportType(sentinelType.ElementType, context))); } case ElementType.FnPtr: { FunctionPointerType functionPointerType = (FunctionPointerType)type; FunctionPointerType functionPointerType2 = new FunctionPointerType { HasThis = functionPointerType.HasThis, ExplicitThis = functionPointerType.ExplicitThis, CallingConvention = functionPointerType.CallingConvention, ReturnType = ImportType(functionPointerType.ReturnType, context) }; if (!functionPointerType.HasParameters) { return(functionPointerType2); } for (int j = 0; j < functionPointerType.Parameters.Count; j++) { functionPointerType2.Parameters.Add(new ParameterDefinition(ImportType(functionPointerType.Parameters[j].ParameterType, context))); } return(functionPointerType2); } case ElementType.CModOpt: { OptionalModifierType optionalModifierType = (OptionalModifierType)type; return(new OptionalModifierType(ImportType(optionalModifierType.ModifierType, context), ImportType(optionalModifierType.ElementType, context))); } case ElementType.CModReqD: { RequiredModifierType requiredModifierType = (RequiredModifierType)type; return(new RequiredModifierType(ImportType(requiredModifierType.ModifierType, context), ImportType(requiredModifierType.ElementType, context))); } case ElementType.Array: { ArrayType arrayType2 = (ArrayType)type; ArrayType arrayType3 = new ArrayType(ImportType(arrayType2.ElementType, context)); if (arrayType2.IsVector) { return(arrayType3); } Collection <ArrayDimension> dimensions = arrayType2.Dimensions; Collection <ArrayDimension> dimensions2 = arrayType3.Dimensions; dimensions2.Clear(); for (int k = 0; k < dimensions.Count; k++) { ArrayDimension arrayDimension = dimensions[k]; dimensions2.Add(new ArrayDimension(arrayDimension.LowerBound, arrayDimension.UpperBound)); } return(arrayType3); } case ElementType.GenericInst: { GenericInstanceType genericInstanceType = (GenericInstanceType)type; GenericInstanceType genericInstanceType2 = new GenericInstanceType(ImportType(genericInstanceType.ElementType, context)); Collection <TypeReference> genericArguments = genericInstanceType.GenericArguments; Collection <TypeReference> genericArguments2 = genericInstanceType2.GenericArguments; for (int i = 0; i < genericArguments.Count; i++) { genericArguments2.Add(ImportType(genericArguments[i], context)); } return(genericInstanceType2); } case ElementType.Var: { GenericParameter genericParameter2 = (GenericParameter)type; if (genericParameter2.DeclaringType == null) { throw new InvalidOperationException(); } return(context.TypeParameter(genericParameter2.DeclaringType.FullName, genericParameter2.Position)); } case ElementType.MVar: { GenericParameter genericParameter = (GenericParameter)type; if (genericParameter.DeclaringMethod == null) { throw new InvalidOperationException(); } return(context.MethodParameter(context.NormalizeMethodName(genericParameter.DeclaringMethod), genericParameter.Position)); } default: throw new NotSupportedException(type.etype.ToString()); } }
public void Insert(int index, ArrayDimension value) { if (OnArrayDimensionAdded != null && !this.Contains (value)) OnArrayDimensionAdded (this, new ArrayDimensionEventArgs (value)); m_items.Insert (index, value); }
public int IndexOf (ArrayDimension value) { return List.IndexOf (value); }
public void Remove (ArrayDimension value) { List.Remove (value); }
public void Add(ArrayDimension value) { if (OnArrayDimensionAdded != null && !this.Contains (value)) OnArrayDimensionAdded (this, new ArrayDimensionEventArgs (value)); m_items.Add (value); }
public void Remove(ArrayDimension value) { List.Remove(value); }
public bool Contains(ArrayDimension value) { return(List.Contains(value)); }
public int IndexOf(ArrayDimension value) { return(List.IndexOf(value)); }
public void Add(ArrayDimension value) { List.Add(value); }
public bool Contains(ArrayDimension value) { return m_items.Contains (value); }
public void Remove(ArrayDimension value) { if (OnArrayDimensionRemoved != null && this.Contains (value)) OnArrayDimensionRemoved (this, new ArrayDimensionEventArgs (value)); m_items.Remove (value); }
public void Add (ArrayDimension value) { List.Add (value); }
public int IndexOf(ArrayDimension value) { return(m_items.IndexOf(value)); }
public bool Contains (ArrayDimension value) { return List.Contains (value); }
private TypeReference ImportTypeSpecification(TypeReference type, ImportGenericContext context) { ElementType elementType = type.etype; if (elementType > ElementType.CModOpt) { if (elementType == ElementType.Sentinel) { SentinelType sentinelType = (SentinelType)type; return(new SentinelType(this.ImportType(sentinelType.ElementType, context))); } if (elementType == ElementType.Pinned) { PinnedType pinnedType = (PinnedType)type; return(new PinnedType(this.ImportType(pinnedType.ElementType, context))); } } else { switch (elementType) { case ElementType.Ptr: { PointerType pointerType = (PointerType)type; return(new PointerType(this.ImportType(pointerType.ElementType, context))); } case ElementType.ByRef: { ByReferenceType byReferenceType = (ByReferenceType)type; return(new ByReferenceType(this.ImportType(byReferenceType.ElementType, context))); } case ElementType.ValueType: case ElementType.Class: { break; } case ElementType.Var: { GenericParameter genericParameter = (GenericParameter)type; if (genericParameter.DeclaringType == null) { throw new InvalidOperationException(); } return(context.TypeParameter(genericParameter.DeclaringType.FullName, genericParameter.Position)); } case ElementType.Array: { ArrayType arrayType = (ArrayType)type; ArrayType arrayType1 = new ArrayType(this.ImportType(arrayType.ElementType, context)); if (arrayType.IsVector) { return(arrayType1); } Collection <ArrayDimension> dimensions = arrayType.Dimensions; Collection <ArrayDimension> arrayDimensions = arrayType1.Dimensions; arrayDimensions.Clear(); for (int i = 0; i < dimensions.Count; i++) { ArrayDimension item = dimensions[i]; arrayDimensions.Add(new ArrayDimension(item.LowerBound, item.UpperBound)); } return(arrayType1); } case ElementType.GenericInst: { GenericInstanceType genericInstanceType = (GenericInstanceType)type; GenericInstanceType genericInstanceType1 = new GenericInstanceType(this.ImportType(genericInstanceType.ElementType, context)); Collection <TypeReference> genericArguments = genericInstanceType.GenericArguments; Collection <TypeReference> typeReferences = genericInstanceType1.GenericArguments; for (int j = 0; j < genericArguments.Count; j++) { typeReferences.Add(this.ImportType(genericArguments[j], context)); } return(genericInstanceType1); } default: { switch (elementType) { case ElementType.SzArray: { ArrayType arrayType2 = (ArrayType)type; return(new ArrayType(this.ImportType(arrayType2.ElementType, context))); } case ElementType.MVar: { GenericParameter genericParameter1 = (GenericParameter)type; if (genericParameter1.DeclaringMethod == null) { throw new InvalidOperationException(); } return(context.MethodParameter(context.NormalizeMethodName(genericParameter1.DeclaringMethod), genericParameter1.Position)); } case ElementType.CModReqD: { RequiredModifierType requiredModifierType = (RequiredModifierType)type; return(new RequiredModifierType(this.ImportType(requiredModifierType.ModifierType, context), this.ImportType(requiredModifierType.ElementType, context))); } case ElementType.CModOpt: { OptionalModifierType optionalModifierType = (OptionalModifierType)type; return(new OptionalModifierType(this.ImportType(optionalModifierType.ModifierType, context), this.ImportType(optionalModifierType.ElementType, context))); } } break; } } } throw new NotSupportedException(type.etype.ToString()); }
public void Insert (int index, ArrayDimension value) { List.Insert (index, value); }
public ArrayDimensionEventArgs(ArrayDimension item) { m_item = item; }
private TypeReference ImportTypeSpecification(TypeReference type, ImportGenericContext context) { ElementType etype = type.etype; if (etype > ElementType.CModOpt) { if (etype == ElementType.Sentinel) { SentinelType type6 = (SentinelType)type; return(new SentinelType(this.ImportType(type6.ElementType, context))); } if (etype == ElementType.Pinned) { PinnedType type5 = (PinnedType)type; return(new PinnedType(this.ImportType(type5.ElementType, context))); } } else { switch (etype) { case ElementType.Ptr: { PointerType type3 = (PointerType)type; return(new PointerType(this.ImportType(type3.ElementType, context))); } case ElementType.ByRef: { ByReferenceType type4 = (ByReferenceType)type; return(new ByReferenceType(this.ImportType(type4.ElementType, context))); } case ElementType.ValueType: case ElementType.Class: break; case ElementType.Var: { GenericParameter parameter = (GenericParameter)type; if (parameter.DeclaringType == null) { throw new InvalidOperationException(); } return(context.TypeParameter(parameter.DeclaringType.FullName, parameter.Position)); } case ElementType.Array: { ArrayType type9 = (ArrayType)type; ArrayType type10 = new ArrayType(this.ImportType(type9.ElementType, context)); if (!type9.IsVector) { Collection <ArrayDimension> dimensions = type9.Dimensions; Collection <ArrayDimension> collection2 = type10.Dimensions; collection2.Clear(); for (int i = 0; i < dimensions.Count; i++) { ArrayDimension dimension = dimensions[i]; collection2.Add(new ArrayDimension(dimension.LowerBound, dimension.UpperBound)); } } return(type10); } case ElementType.GenericInst: { GenericInstanceType type11 = (GenericInstanceType)type; GenericInstanceType type12 = new GenericInstanceType(this.ImportType(type11.ElementType, context)); Collection <TypeReference> genericArguments = type11.GenericArguments; Collection <TypeReference> collection4 = type12.GenericArguments; for (int i = 0; i < genericArguments.Count; i++) { collection4.Add(this.ImportType(genericArguments[i], context)); } return(type12); } default: switch (etype) { case ElementType.SzArray: { ArrayType type2 = (ArrayType)type; return(new ArrayType(this.ImportType(type2.ElementType, context))); } case ElementType.MVar: { GenericParameter parameter2 = (GenericParameter)type; if (parameter2.DeclaringMethod == null) { throw new InvalidOperationException(); } return(context.MethodParameter(parameter2.DeclaringMethod.Name, parameter2.Position)); } case ElementType.CModReqD: { RequiredModifierType type8 = (RequiredModifierType)type; return(new RequiredModifierType(this.ImportType(type8.ModifierType, context), this.ImportType(type8.ElementType, context))); } case ElementType.CModOpt: { OptionalModifierType type7 = (OptionalModifierType)type; return(new OptionalModifierType(this.ImportType(type7.ModifierType, context), this.ImportType(type7.ElementType, context))); } default: break; } break; } } throw new NotSupportedException(type.etype.ToString()); }
public void Insert(int index, ArrayDimension value) { List.Insert(index, value); }
public int IndexOf(ArrayDimension value) { return m_items.IndexOf (value); }