private TType DecodeModifiedType(ref BlobReader blobReader, bool isRequired) { TType modifier = DecodeTypeHandle(ref blobReader, 0, allowTypeSpecifications: true); TType unmodifiedType = DecodeType(ref blobReader); return(_provider.GetModifiedType(modifier, unmodifiedType, isRequired)); }
// Decodes a type with custom modifiers starting with the first modifier type that is required iff isRequired is passed,\ // followed by an optional sequence of additional modifiers (<SignaureTypeCode.Required|OptionalModifier> <type>) and // terminated by the unmodified type. private static TType DecodeModifiedType <TType>(ref BlobReader blobReader, ISignatureTypeProvider <TType> provider, bool isRequired) { TType type = DecodeTypeHandle(ref blobReader, provider, null); var modifier = new CustomModifier <TType>(type, isRequired); ImmutableArray <CustomModifier <TType> > modifiers; int typeCode = blobReader.ReadCompressedInteger(); isRequired = typeCode == (int)SignatureTypeCode.RequiredModifier; if (!isRequired && typeCode != (int)SignatureTypeCode.OptionalModifier) { // common case: 1 modifier. modifiers = ImmutableArray.Create(modifier); } else { // uncommon case: multiple modifiers. var builder = ImmutableArray.CreateBuilder <CustomModifier <TType> >(); builder.Add(modifier); do { type = DecodeTypeHandle(ref blobReader, provider, null); modifier = new CustomModifier <TType>(type, isRequired); builder.Add(modifier); typeCode = blobReader.ReadCompressedInteger(); isRequired = typeCode == (int)SignatureTypeCode.RequiredModifier; } while (isRequired || typeCode == (int)SignatureTypeCode.OptionalModifier); modifiers = builder.ToImmutable(); } TType unmodifiedType = DecodeType(ref blobReader, typeCode, provider); return(provider.GetModifiedType(unmodifiedType, modifiers)); }
private TType DecodeModifiedType(ref BlobReader blobReader, bool isRequired) { TType modifier = DecodeTypeHandle(ref blobReader, SignatureTypeHandleCode.Unresolved, allowTypeSpecifications: true); TType unmodifiedType = DecodeType(ref blobReader); return(_provider.GetModifiedType(_metadataReaderOpt, isRequired, modifier, unmodifiedType)); }
private TType DecodeModifiedType(ref BlobReader blobReader, bool isRequired) { EntityHandle modifier = blobReader.ReadTypeHandle(); TType unmodifiedType = DecodeType(ref blobReader); return(_provider.GetModifiedType(_metadataReaderOpt, isRequired, modifier, unmodifiedType)); }