static private ILValue GenerateInspectedObjectRead_Nullable(Type type, ILValue buffer) { return(new ILIfValue( buffer.GetILInvoke("ReadBoolean"), TypeSerializer.GetTypeSerializer(type).GenerateRead(buffer), null )); }
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) ) )); }
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)); }
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)); }