PushPrimitiveReaderOntoStack() public method

public PushPrimitiveReaderOntoStack ( ) : void
return void
コード例 #1
0
        internal static void GenerateReadPrimitive(ReaderGenerationContext context, Type type)
        {
            context.PushPrimitiveReaderOntoStack();
            var mname      = string.Concat("Read", type.Name);
            var readMethod = typeof(PrimitiveReader).GetMethod(mname);

            if (readMethod == null)
            {
                throw new ArgumentException("Method <<" + mname + ">> not found");
            }

            context.Generator.Emit(OpCodes.Call, readMethod);
        }
コード例 #2
0
        private static void GenerateUpdateElements(ReaderGenerationContext context, Type formalType, LocalBuilder objectIdLocal)
        {
            if (typeof(ISpeciallySerializable).IsAssignableFrom(formalType))
            {
                context.PushDeserializedObjectOntoStack(objectIdLocal);
                context.Generator.Emit(OpCodes.Castclass, typeof(ISpeciallySerializable));
                context.PushPrimitiveReaderOntoStack();
                context.Generator.GenerateCodeCall <ISpeciallySerializable, PrimitiveReader>(ObjectReader.LoadAndVerifySpeciallySerializableAndVerify);
                return;
            }

            CollectionMetaToken collectionToken;

            if (!CollectionMetaToken.TryGetCollectionMetaToken(formalType, out collectionToken))
            {
                throw new InvalidOperationException(InternalErrorMessage);
            }

            GenerateFillCollection(context, collectionToken.FormalElementType, formalType, objectIdLocal);
        }