Exemplo n.º 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);
                            }
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
     }
 }
Exemplo n.º 6
0
 void IProtoSerializer.EmitWrite(Compiler.CompilerContext ctx, Compiler.Local valueFrom)
 {
     head.EmitWrite(ctx, valueFrom);
 }
Exemplo n.º 7
0
 void IRuntimeProtoSerializerNode.EmitWrite(Compiler.CompilerContext ctx, Compiler.Local valueFrom)
 => head.EmitWrite(ctx, valueFrom);