static bool TypeMatch(IModifierType a, IModifierType b, ref Dictionary<string, string> gp) { if (!TypeMatch(a.ModifierType, b.ModifierType, ref gp)) return false; return TypeMatch(a.ElementType, b.ElementType, ref gp); }
static bool TypeMatch(IModifierType a, IModifierType b) { if (!TypeMatch(a.ModifierType, b.ModifierType)) return false; return TypeMatch(a.ElementType, b.ElementType); }
static bool IsParameterCompatibleWith(IModifierType a, IModifierType b) { if (!IsParameterCompatibleWith(a.ModifierType, b.ModifierType)) { return(false); } return(IsParameterCompatibleWith(a.ElementType, b.ElementType)); }
public static bool TypeMatch(IModifierType a, IModifierType b) { if (!Helpers.TypeMatch(a.ModifierType, b.ModifierType)) { return(false); } return(Helpers.TypeMatch(a.ElementType, b.ElementType)); }
static bool IsParameterCompatibleWith(IModifierType a, IModifierType b, IMetadataResolver?cache) { if (!IsParameterCompatibleWith(a.ModifierType, b.ModifierType, cache)) { return(false); } return(IsParameterCompatibleWith(a.ElementType, b.ElementType, cache)); }
static bool IsParameterCompatibleWith(IModifierType a, IModifierType b, TypeDefinitionCache?cache) { if (!IsParameterCompatibleWith(a.ModifierType, b.ModifierType, cache)) { return(false); } return(IsParameterCompatibleWith(a.ElementType, b.ElementType, cache)); }
public bool TypeMatch(IModifierType a, IModifierType b) { if (!TypeMatch(a.ModifierType, b.ModifierType)) { return(false); } return(TypeMatch(a.ElementType, b.ElementType)); }
public static bool TypeMatch(IModifierType a, IModifierType b) { if (!Helpers.TypeMatch(a.ModifierType, b.ModifierType)) { return false; } return TypeMatch(a.ElementType, b.ElementType); }
static bool TypeMatch(IModifierType a, IModifierType b, ref Dictionary <string, string> gp) { if (!TypeMatch(a.ModifierType, b.ModifierType, ref gp)) { return(false); } return(TypeMatch(a.ElementType, b.ElementType, ref gp)); }
/// <summary> /// Checks if <paramref name="type"/> is void or not. /// </summary> /// <param name="type">The type to be checked.</param> /// <returns>Returns true, if the type is void.</returns> private bool IsVoid(TypeReference type) { if (type.IsPointer) { /// void * is not considered void as void* represents pointer. return(false); } if (type is IModifierType) { IModifierType optional = type as IModifierType; return(IsVoid(optional.ElementType)); } if (type.FullName == Constants.Void) { return(true); } return(false); }
internal bool AreSame(IModifierType a, IModifierType b) { return(AreSame(a.ModifierType, b.ModifierType)); }
public static bool IsEqualTo(this IModifierType a, IModifierType b) { return IsEqualTo(a.ModifierType, b.ModifierType); }
private void WriteModifierSignature(ElementType element_type, IModifierType type) { this.WriteElementType(element_type); base.WriteCompressedUInt32(this.MakeTypeDefOrRefCodedRID(type.ModifierType)); this.WriteTypeSignature(type.ElementType); }
public static bool IsSameType(IModifierType a, IModifierType b, bool genericMatch) { return IsSameType(a.ModifierType, b.ModifierType, genericMatch); }
private static TypeReference InflateGenericType(GenericInstanceType genericInstanceProvider, TypeReference typeToInflate) { ArrayType type = typeToInflate as ArrayType; if (type != null) { TypeReference reference = InflateGenericType(genericInstanceProvider, type.ElementType); if (reference != type.ElementType) { return(new ArrayType(reference, type.Rank)); } return(type); } GenericInstanceType baseType = typeToInflate as GenericInstanceType; if (baseType != null) { return(MakeGenericType(genericInstanceProvider, baseType)); } GenericParameter genericParameter = typeToInflate as GenericParameter; if (genericParameter != null) { GenericParameter parameter = ResolveType(genericInstanceProvider.ElementType).GenericParameters.Single <GenericParameter>(p => p == genericParameter); return(genericInstanceProvider.GenericArguments[parameter.Position]); } FunctionPointerType type3 = typeToInflate as FunctionPointerType; if (type3 != null) { FunctionPointerType type9 = new FunctionPointerType { ReturnType = InflateGenericType(genericInstanceProvider, type3.ReturnType) }; for (int i = 0; i < type3.Parameters.Count; i++) { TypeReference parameterType = InflateGenericType(genericInstanceProvider, type3.Parameters[i].ParameterType); type9.Parameters.Add(new ParameterDefinition(parameterType)); } return(type9); } IModifierType type4 = typeToInflate as IModifierType; if (type4 != null) { TypeReference modifierType = InflateGenericType(genericInstanceProvider, type4.ModifierType); TypeReference reference4 = InflateGenericType(genericInstanceProvider, type4.ElementType); if (type4 is OptionalModifierType) { return(new OptionalModifierType(modifierType, reference4)); } return(new RequiredModifierType(modifierType, reference4)); } PinnedType type5 = typeToInflate as PinnedType; if (type5 != null) { TypeReference reference5 = InflateGenericType(genericInstanceProvider, type5.ElementType); if (reference5 != type5.ElementType) { return(new PinnedType(reference5)); } return(type5); } PointerType type6 = typeToInflate as PointerType; if (type6 != null) { TypeReference reference6 = InflateGenericType(genericInstanceProvider, type6.ElementType); if (reference6 != type6.ElementType) { return(new PointerType(reference6)); } return(type6); } ByReferenceType type7 = typeToInflate as ByReferenceType; if (type7 != null) { TypeReference reference7 = InflateGenericType(genericInstanceProvider, type7.ElementType); if (reference7 != type7.ElementType) { return(new ByReferenceType(reference7)); } return(type7); } SentinelType type8 = typeToInflate as SentinelType; if (type8 == null) { return(typeToInflate); } TypeReference reference8 = InflateGenericType(genericInstanceProvider, type8.ElementType); if (reference8 != type8.ElementType) { return(new SentinelType(reference8)); } return(type8); }
void RecordModifierType(IModifierType mod) { RecordType (mod.ModifierType); }
internal bool AreSame(IModifierType a, IModifierType b) { return AreSame(a.ModifierType, b.ModifierType); }
public static bool AreSame(IModifierType a, IModifierType b) { if (!AreSame(a.ModifierType, b.ModifierType)) return false; return AreSame(a.ElementType, b.ElementType); }
private static bool AreSame(IModifierType a, IModifierType b) => AreSame(a.ModifierType, b.ModifierType);
static int GetHashCodeHelper2(IModifierType type) { return(MetadataResolver.GetHashCode(type.ModifierType)); }
/// <summary> /// Are type a and b the same? /// </summary> public static bool AreSame(this IModifierType a, IModifierType b, Func<GenericParameter, TypeReference> genericParamResolver) { return AreSame(a.ModifierType, b.ModifierType, genericParamResolver); }
private static bool AreSame(IModifierType a, IModifierType b) { return TypeMatch(a.ModifierType, b.ModifierType); }
private static bool AreSame(IModifierType a, IModifierType b) { return(MetadataResolver.AreSame(a.ModifierType, b.ModifierType)); }
static bool AreSame(IModifierType a, IModifierType b) { return AreSame (a.ModifierType, b.ModifierType); }
void MarkModifierType (IModifierType mod) { MarkType (mod.ModifierType); }
public static bool IsEqualTo(this IModifierType a, IModifierType b) { return(IsEqualTo(a.ModifierType, b.ModifierType)); }
void WriteModiferTypeSignature(IModifierType type, char id) { WriteTypeSignature(type.ElementType); this.id.Append(id); WriteTypeSignature(type.ModifierType); }
/// <summary> /// Are type a and b the same? /// </summary> public static bool AreSame(this IModifierType a, IModifierType b, Func <GenericParameter, TypeReference> genericParamResolver) { return(AreSame(a.ModifierType, b.ModifierType, genericParamResolver)); }
static bool AreSame(IModifierType a, IModifierType b) { return(AreSame(a.ModifierType, b.ModifierType)); }
public void WriteTypeSignature(TypeReference type) { if (type == null) { throw new ArgumentNullException(); } ElementType etype = type.etype; ElementType elementType = etype; if (elementType <= ElementType.GenericInst) { if (elementType == ElementType.None) { this.WriteElementType(type.IsValueType ? ElementType.ValueType : ElementType.Class); base.WriteCompressedUInt32(this.MakeTypeDefOrRefCodedRID(type)); return; } switch (elementType) { case ElementType.Ptr: case ElementType.ByRef: goto IL_E3; case ElementType.ValueType: case ElementType.Class: goto IL_17D; case ElementType.Var: break; case ElementType.Array: { ArrayType arrayType = (ArrayType)type; if (!arrayType.IsVector) { this.WriteArrayTypeSignature(arrayType); return; } this.WriteElementType(ElementType.SzArray); this.WriteTypeSignature(arrayType.ElementType); return; } case ElementType.GenericInst: { GenericInstanceType genericInstanceType = (GenericInstanceType)type; this.WriteElementType(ElementType.GenericInst); this.WriteElementType(genericInstanceType.IsValueType ? ElementType.ValueType : ElementType.Class); base.WriteCompressedUInt32(this.MakeTypeDefOrRefCodedRID(genericInstanceType.ElementType)); this.WriteGenericInstanceSignature(genericInstanceType); return; } default: goto IL_17D; } } else { switch (elementType) { case ElementType.FnPtr: { FunctionPointerType method = (FunctionPointerType)type; this.WriteElementType(ElementType.FnPtr); this.WriteMethodSignature(method); return; } case ElementType.Object: case ElementType.SzArray: goto IL_17D; case ElementType.MVar: break; case ElementType.CModReqD: case ElementType.CModOpt: { IModifierType type2 = (IModifierType)type; this.WriteModifierSignature(etype, type2); return; } default: if (elementType != ElementType.Sentinel && elementType != ElementType.Pinned) { goto IL_17D; } goto IL_E3; } } GenericParameter genericParameter = (GenericParameter)type; this.WriteElementType(etype); int position = genericParameter.Position; if (position == -1) { throw new NotSupportedException(); } base.WriteCompressedUInt32((uint)position); return; IL_E3: TypeSpecification typeSpecification = (TypeSpecification)type; this.WriteElementType(etype); this.WriteTypeSignature(typeSpecification.ElementType); return; IL_17D: if (!this.TryWriteElementType(type)) { throw new NotSupportedException(); } }
void MarkModifierType(IModifierType mod) { MarkType(mod.ModifierType); }
public void WriteTypeSignature(TypeReference type) { if (type == null) { throw new ArgumentNullException(); } ElementType etype = type.etype; switch (etype) { case ElementType.Var: case ElementType.MVar: { GenericParameter obj = (GenericParameter)type; WriteElementType(etype); int position = obj.Position; if (position == -1) { throw new NotSupportedException(); } base.WriteCompressedUInt32((uint)position); break; } case ElementType.GenericInst: { GenericInstanceType genericInstanceType = (GenericInstanceType)type; WriteElementType(ElementType.GenericInst); WriteElementType(genericInstanceType.IsValueType ? ElementType.ValueType : ElementType.Class); base.WriteCompressedUInt32(MakeTypeDefOrRefCodedRID(genericInstanceType.ElementType)); WriteGenericInstanceSignature(genericInstanceType); break; } case ElementType.Ptr: case ElementType.ByRef: case ElementType.Sentinel: case ElementType.Pinned: { TypeSpecification typeSpecification = (TypeSpecification)type; WriteElementType(etype); WriteTypeSignature(typeSpecification.ElementType); break; } case ElementType.FnPtr: { FunctionPointerType method = (FunctionPointerType)type; WriteElementType(ElementType.FnPtr); WriteMethodSignature(method); break; } case ElementType.CModReqD: case ElementType.CModOpt: { IModifierType type2 = (IModifierType)type; WriteModifierSignature(etype, type2); break; } case ElementType.Array: { ArrayType arrayType = (ArrayType)type; if (!arrayType.IsVector) { WriteArrayTypeSignature(arrayType); } else { WriteElementType(ElementType.SzArray); WriteTypeSignature(arrayType.ElementType); } break; } case ElementType.None: WriteElementType(type.IsValueType ? ElementType.ValueType : ElementType.Class); base.WriteCompressedUInt32(MakeTypeDefOrRefCodedRID(type)); break; default: if (TryWriteElementType(type)) { break; } throw new NotSupportedException(); } }