Esempio n. 1
0
        public override void ReadRest(ReaderContext ctxt, BlobReader reader)
        {
            if (TypeArity > 0)
                TypeArity = (int)reader.ReadCompressedUInt32();

            var paramCount = (int)reader.ReadCompressedUInt32();
            ReturnType = new TypeWithCustomMods();
            ReturnType.Read(ctxt, reader);
            var sentinelIndex = -1;
            if (paramCount > 0)
            {
                var parameters = new Seq<TypeWithCustomMods>(paramCount);
                for (var i = 0; i < paramCount; i++)
                {
                    var param = new TypeWithCustomMods();
                    param.Read(ctxt, reader);
                    if (param.Type.IsSentinel)
                    {
                        if (CallingConvention == CallingConvention.ManagedVarArg ||
                            CallingConvention == CallingConvention.NativeC)
                        {
                            if (sentinelIndex > 0)
                                throw new PEException("multiple sentinels in VARARG/C signature");
                            sentinelIndex = i;
                            i--;
                        }
                        else
                            throw new PEException("unexpected sentinel in non-VARARG/C signature");
                    }
                    else
                        parameters.Add(param);
                }
                Parameters = parameters;
            }
            else
                Parameters = Constants.EmptyTypeWithCustomMods;
            VarArgs = sentinelIndex < 0 ? 0 : paramCount - sentinelIndex;
        }
Esempio n. 2
0
 public void Read(ReaderContext ctxt, BlobReader reader)
 {
     var customMods = default(Seq<CustomModPseudoTypeSig>);
     var type = TypeSig.Read(ctxt, reader);
     while (type.IsCustomMod || type.IsPinned)
     {
         if (type.IsCustomMod)
         {
             if (customMods == null)
                 customMods = new Seq<CustomModPseudoTypeSig>();
             customMods.Add((CustomModPseudoTypeSig)type);
         }
         else
             IsPinned = true;
         type = TypeSig.Read(ctxt, reader);
     }
     Type = new TypeWithCustomMods { CustomMods = customMods ?? Constants.EmptyCustomModSigs, Type = type };
 }
Esempio n. 3
0
 public override void ReadRest(ReaderContext ctxt, BlobReader reader)
 {
     ElementType = new TypeWithCustomMods();
     ElementType.Read(ctxt, reader);
 }
Esempio n. 4
0
 public override void ReadRest(ReaderContext ctxt, BlobReader reader)
 {
     var paramCount = (int)reader.ReadCompressedUInt32();
     ReturnType = new TypeWithCustomMods();
     ReturnType.Read(ctxt, reader);
     if (paramCount > 0)
     {
         var parameters = new Seq<TypeSig>(paramCount);
         for (var i = 0; i < paramCount; i++)
             parameters.Add(TypeSig.Read(ctxt, reader));
         Parameters = parameters;
     }
     else
         Parameters = Constants.EmptyTypeSigs;
 }