/// <returns>The qualified name (i.e. including containing types and namespaces) of a named, /// pointer, or array type.</returns> internal string GetTypeName(TypeAndCustomInfo typeAndInfo, bool escapeKeywordIdentifiers, out bool sawInvalidIdentifier) { var type = typeAndInfo.Type; if (type == null) { throw new ArgumentNullException(nameof(type)); } ReadOnlyCollection <byte> dynamicFlags = null; ReadOnlyCollection <string> tupleElementNames = null; var typeInfo = typeAndInfo.Info; if (typeInfo != null) { CustomTypeInfo.Decode(typeInfo.PayloadTypeId, typeInfo.Payload, out dynamicFlags, out tupleElementNames); } var dynamicFlagIndex = 0; var tupleElementIndex = 0; var pooled = PooledStringBuilder.GetInstance(); AppendQualifiedTypeName( pooled.Builder, type, dynamicFlags, ref dynamicFlagIndex, tupleElementNames, ref tupleElementIndex, escapeKeywordIdentifiers, out sawInvalidIdentifier); return(pooled.ToStringAndFree()); }
internal DkmClrCustomTypeInfo SubstituteCustomTypeInfo( Type type, DkmClrCustomTypeInfo customInfo ) { if (_typeDefinition == null) { return(customInfo); } ReadOnlyCollection <byte> dynamicFlags = null; ReadOnlyCollection <string> tupleElementNames = null; if (customInfo != null) { CustomTypeInfo.Decode( customInfo.PayloadTypeId, customInfo.Payload, out dynamicFlags, out tupleElementNames ); } var substitutedFlags = SubstituteDynamicFlags(type, dynamicFlags); var substitutedNames = SubstituteTupleElementNames(type, tupleElementNames); return(CustomTypeInfo.Create(substitutedFlags, substitutedNames)); }
internal static CustomTypeInfoTypeArgumentMap Create(TypeAndCustomInfo typeAndInfo) { var typeInfo = typeAndInfo.Info; if (typeInfo == null) { return(s_empty); } var type = typeAndInfo.Type; Debug.Assert(type != null); if (!type.IsGenericType) { return(s_empty); } ReadOnlyCollection <byte> dynamicFlags; ReadOnlyCollection <string> tupleElementNames; CustomTypeInfo.Decode( typeInfo.PayloadTypeId, typeInfo.Payload, out dynamicFlags, out tupleElementNames ); if (dynamicFlags == null && tupleElementNames == null) { return(s_empty); } var typeDefinition = type.GetGenericTypeDefinition(); Debug.Assert(typeDefinition != null); var dynamicFlagStartIndices = (dynamicFlags == null) ? null : GetStartIndices(type, t => 1); var tupleElementNameStartIndices = (tupleElementNames == null) ? null : GetStartIndices(type, TypeHelpers.GetTupleCardinalityIfAny); return(new CustomTypeInfoTypeArgumentMap( typeDefinition, dynamicFlags, dynamicFlagStartIndices, tupleElementNames, tupleElementNameStartIndices )); }
/// <summary> /// Return a copy of the custom type info with the leading dynamic flag removed. /// There are no changes to tuple element names since this is used for walking /// into an array element type only which does not affect tuple element names. /// </summary> internal static DkmClrCustomTypeInfo SkipOne(DkmClrCustomTypeInfo customInfo) { if (customInfo == null) { return(customInfo); } ReadOnlyCollection <byte> dynamicFlags; ReadOnlyCollection <string> tupleElementNames; CustomTypeInfo.Decode( customInfo.PayloadTypeId, customInfo.Payload, out dynamicFlags, out tupleElementNames); if (dynamicFlags == null) { return(customInfo); } return(Create(DynamicFlagsCustomTypeInfo.SkipOne(dynamicFlags), tupleElementNames)); }