// this reads just the optional parameter types, from a MethodRefSig internal static Type[] ReadOptionalParameterTypes(ModuleReader module, ByteReader br, IGenericContext context, out CustomModifiers[] customModifiers) { br.ReadByte(); int paramCount = br.ReadCompressedUInt(); CustomModifiers.Skip(br); ReadRetType(module, br, context); for (int i = 0; i < paramCount; i++) { if (br.PeekByte() == SENTINEL) { br.ReadByte(); Type[] types = new Type[paramCount - i]; customModifiers = new CustomModifiers[types.Length]; for (int j = 0; j < types.Length; j++) { customModifiers[j] = CustomModifiers.Read(module, br, context); types[j] = ReadType(module, br, context); } return(types); } CustomModifiers.Skip(br); ReadType(module, br, context); } customModifiers = Empty <CustomModifiers> .Array; return(Type.EmptyTypes); }
internal static Type ReadTypeSpec(ModuleReader module, ByteReader br, IGenericContext context) { // LAMESPEC a TypeSpec can contain custom modifiers (C++/CLI generates "newarr (TypeSpec with custom modifiers)") CustomModifiers.Skip(br); // LAMESPEC anything can be adorned by (useless) custom modifiers // also, VAR and MVAR are also used in TypeSpec (contrary to what the spec says) return(ReadType(module, br, context)); }
internal static Type[] ReadMethodSpec(ModuleReader module, ByteReader br, IGenericContext context) { if (br.ReadByte() != GENERICINST) { throw new BadImageFormatException(); } Type[] args = new Type[br.ReadCompressedUInt()]; for (int i = 0; i < args.Length; i++) { CustomModifiers.Skip(br); args[i] = ReadType(module, br, context); } return(args); }