Exemple #1
0
 static private ILValue GenerateInspectedObjectRead_Nullable(Type type, ILValue buffer)
 {
     return(new ILIfValue(
                buffer.GetILInvoke("ReadBoolean"),
                TypeSerializer.GetTypeSerializer(type).GenerateRead(buffer),
                null
                ));
 }
Exemple #2
0
 static private ILStatement GenerateInspectedObjectWrite_Nullable(ILValue value, ILValue buffer)
 {
     return(new ILIf(
                value.GetILIsNotNull(),
                new ILBlock(
                    buffer.GetILInvoke("WriteBoolean", true),
                    TypeSerializer.GetTypeSerializer(value.GetValueType()).GenerateWrite(value, buffer)
                    ),
                new ILBlock(
                    buffer.GetILInvoke("WriteBoolean", false)
                    )
                ));
 }
Exemple #3
0
            static public ILStatement GenerateInspectedObjectWrite(ILValue src, ILValue buffer)
            {
                if (src.GetValueType().HasChildTypes())
                {
                    return(GenerateInspectedObjectWrite_Polymorphic(src, buffer));
                }

                if (src.GetValueType().IsNullable())
                {
                    return(GenerateInspectedObjectWrite_Nullable(src, buffer));
                }

                return(TypeSerializer.GetTypeSerializer(src.GetValueType()).GenerateWrite(src, buffer));
            }
Exemple #4
0
            static public ILValue GenerateInspectedObjectRead(Type type, ILValue buffer)
            {
                if (type.HasChildTypes())
                {
                    return(GenerateInspectedObjectRead_Polymorphic(type, buffer));
                }

                if (type.IsNullable())
                {
                    return(GenerateInspectedObjectRead_Nullable(type, buffer));
                }

                return(TypeSerializer.GetTypeSerializer(type).GenerateRead(buffer));
            }