Exemple #1
0
        public void EmitWrite(Compiler.CompilerContext ctx, Compiler.Local valueFrom)
        {
            using (ctx.StartDebugBlockAuto(this))
            {
                var g = ctx.G;

                g.Writer.ExpectRoot();
                if (_protoCompatibility)
                {
                    _serializer.EmitWrite(ctx, valueFrom);
                    return;
                }

                using (var rootToken = ctx.Local(typeof(SubItemToken)))
                    using (var typeKey = ctx.Local(typeof(int)))
                        using (var obj = ctx.Local(typeof(object)))
                            using (var refKey = ctx.Local(typeof(int)))
                            {
                                g.Assign(rootToken, g.WriterFunc.StartSubItem(null, false));
                                g.Writer.WriteFieldHeaderBegin(CurrentFormatVersion);
                                _serializer.EmitWrite(ctx, valueFrom);
                                g.While(g.StaticFactory.Invoke(typeof(ProtoWriter), nameof(ProtoWriter.TryGetNextLateReference), typeKey, obj, refKey, g.ArgReaderWriter()));
                                {
                                    g.Writer.WriteFieldHeaderBegin(refKey.AsOperand + 1);
                                    g.Writer.WriteRecursionSafeObject(obj, typeKey);
                                }
                                g.End();
                                g.Writer.EndSubItem(rootToken);
                            }
            }
        }
Exemple #2
0
 void IProtoSerializer.EmitWrite(Compiler.CompilerContext ctx, Compiler.Local valueFrom)
 {
     using (ctx.StartDebugBlockAuto(this))
     {
         _head.EmitWrite(ctx, valueFrom);
     }
 }
        void IProtoSerializer.EmitWrite(Compiler.CompilerContext ctx, Compiler.Local valueFrom)

        {
            ctx.LoadValue(valueFrom);

            ctx.EmitCall(toTail);

            rootTail.EmitWrite(ctx, null);
        }
Exemple #4
0
 void IProtoSerializer.EmitWrite(Compiler.CompilerContext ctx, Compiler.Local valueFrom)
 {
     using (ctx.StartDebugBlockAuto(this))
     {
         ctx.LoadValue(valueFrom);
         ctx.EmitCall(_toTail);
         _rootTail.EmitWrite(ctx, null);
     }
 }
 public void EmitWrite(Compiler.CompilerContext ctx, Compiler.Local valueFrom)
 {
     using (ctx.StartDebugBlockAuto(this))
     {
         var g = ctx.G;
         g.Writer.WriteFieldHeaderBegin(_number);
         _serializer.EmitWrite(ctx, valueFrom);
     }
 }
Exemple #6
0
 void IProtoSerializer.EmitWrite(Compiler.CompilerContext ctx, Compiler.Local valueFrom)
 {
     head.EmitWrite(ctx, valueFrom);
 }
Exemple #7
0
 void IRuntimeProtoSerializerNode.EmitWrite(Compiler.CompilerContext ctx, Compiler.Local valueFrom)
 => head.EmitWrite(ctx, valueFrom);