anchor.diff:        [erl_syntax:record_field(erl_syntax:atom(FName), ValueSyntaxTree)
          || {FName, ValueSyntaxTree} <- FieldsValueTrees]).
   
  -%record_access(Var, RecordName, FieldName) ->
  -%    erl_syntax:record_access(Var,
  -%                             erl_syntax:atom(RecordName),
  -%                             erl_syntax:atom(FieldName)).
  +record_access(Var, RecordName, FieldName) ->
  +    erl_syntax:record_access(Var,
  +                             erl_syntax:atom(RecordName),
  +                             erl_syntax:atom(FieldName)).
   
   var_f_n(N) ->
       erl_syntax:variable(?ff("F~w", [N])).
  -
  -mk_field_decoder_vi_params(#field{type=Type}=FieldDef, Fill) ->
  -    case is_packed(FieldDef) of
  -        false ->
  -            case Type of
  -                sint32   -> "0, 0"; %% varint-based
  -                sint64   -> "0, 0"; %% varint-based
  -                int32    -> "0, 0"; %% varint-based
  -                int64    -> "0, 0"; %% varint-based
  -                uint32   -> "0, 0"; %% varint-based
  -                uint64   -> "0, 0"; %% varint-based
  -                bool     -> "0, 0"; %% varint-based
  -                {enum,_} -> "0, 0"; %% varint-based
  -                fixed32  -> if Fill == fill -> "0, 0"; true -> "" end;
  -                sfixed32 -> if Fill == fill -> "0, 0"; true -> "" end;
  -                float    -> if Fill == fill -> "0, 0"; true -> "" end;
  -                fixed64  -> if Fill == fill -> "0, 0"; true -> "" end;
  -                sfixed64 -> if Fill == fill -> "0, 0"; true -> "" end;
  -                double   -> if Fill == fill -> "0, 0"; true -> "" end;
  -                string   -> "0, 0"; %% varint-based
  -                bytes    -> "0, 0"; %% varint-based
  -                {msg,_}  -> "0, 0"  %% varint-based
  -            end;
  -        true ->
  -            "0, 0" %% length of packed bytes is varint-based
  -    end.
   
   format_field_decoders(MsgName, MsgDef, AnRes, Opts) ->
       [[format_field_decoder(MsgName, Field, AnRes, Opts), "\n"]
  
positive.code:     end.
  
  format_packed_field_decoder(MsgName, FieldDef, AnRes, Opts) ->
      case get_field_pass(MsgName, AnRes) of
          pass_as_params ->
              format_packed_field_decoder_pap(MsgName, FieldDef, AnRes, Opts);
          pass_as_record ->
              format_packed_field_decoder_par(MsgName, FieldDef, Opts)
      end.
  
  format_packed_field_decoder_pap(MsgName, FieldDef, AnRes, Opts) ->
      NF = get_num_fields(MsgName, AnRes),
      #field{name=FName, rnum=RNum, opts=FOpts}=FieldDef,
      DecodePackWrapFn = mk_fn(d_field_, MsgName, FName),
      FieldDefAsNonpacked = FieldDef#field{opts = FOpts -- [packed]},
      FieldVars = [[", ", f("F~w", [I])] || I <- lists:seq(1, NF)],
      InFieldVars = [[", ", if I == RNum-1 -> "AccSeq";
                               I /= RNum-1 -> f("F~w", [I])
                            end]
                     || I <- lists:seq(1, NF)],
      OutFieldVars = [[", ", if I == RNum-1 -> "NewSeq";
                                I /= RNum-1 -> f("F~w", [I])
                             end]
                      || I <- lists:seq(1, NF)],
      [f("~p(<<1:1, X:7, Rest/binary>>, N, Acc~s) ->~n",
         [DecodePackWrapFn, FieldVars]),
       f("    ~p(Rest, N+7, X bsl N + Acc~s);~n", [DecodePackWrapFn, FieldVars]),
       f("~p(<<0:1, X:7, Rest/binary>>, N, Acc~s) ->~n",
         [DecodePackWrapFn, InFieldVars]),
       f("    Len = X bsl N + Acc,~n"),
       f("    <<PackedBytes:Len/binary, Rest2/binary>> = Rest,~n"),
       f("    NewSeq = ~p(PackedBytes~sAccSeq),~n",
         [mk_fn(d_packed_field_, MsgName, FName),
          case mk_field_decoder_vi_params(FieldDefAsNonpacked, no_fill) of
              ""     -> [", "];
              Params -> [", ", Params, ", "]
          end]),
       f("    ~p(Rest2, 0, 0~s).~n~n",
         [mk_fn(d_read_field_def_, MsgName), OutFieldVars]),
       format_packed_field_seq_decoder(MsgName, FieldDef, Opts)].
  
  format_packed_field_decoder_par(MsgName, FieldDef, Opts) ->
      #field{name=FName, opts=FOpts}=FieldDef,
      DecodePackWrapFn = mk_fn(d_field_, MsgName, FName),
      FieldDefAsNonpacked = FieldDef#field{opts = FOpts -- [packed]},
      [f("~p(<<1:1, X:7, Rest/binary>>, N, Acc, Msg) ->~n", [DecodePackWrapFn]),
       f("    ~p(Rest, N+7, X bsl N + Acc, Msg);~n", [DecodePackWrapFn]),
       f("~p(<<0:1, X:7, Rest/binary>>, N, Acc, #~p{~p=AccSeq}=Msg) ->~n",
         [DecodePackWrapFn, MsgName, FName]),
       f("    Len = X bsl N + Acc,~n"),
       f("    <<PackedBytes:Len/binary, Rest2/binary>> = Rest,~n"),
       f("    NewSeq = ~p(PackedBytes~sAccSeq),~n",
         [mk_fn(d_packed_field_, MsgName, FName),
          case mk_field_decoder_vi_params(FieldDefAsNonpacked, no_fill) of
              ""     -> [", "];
              Params -> [", ", Params, ", "]
          end]),
       f("    NewMsg = Msg#~p{~p=NewSeq},~n", [MsgName, FName]),
       f("    ~p(Rest2, 0, 0, NewMsg).~n~n", [mk_fn(d_read_field_def_, MsgName)]),
       format_packed_field_seq_decoder(MsgName, FieldDef, Opts)].
  
  format_vi_based_field_decoder(MsgName, FieldDef, AnRes, Opts) ->
      #field{name=FName}=FieldDef,
  
negative.code: merge_warns({ok, M, B}, Warns, binary)           -> {ok, M, B, Warns};
  merge_warns({ok, M, B, Warns1}, Warns2, binary)  -> {ok, M, B, Warns2++Warns1};
  merge_warns({error, R}, Warns, _OutFmt)          -> {error, R, Warns};
  merge_warns({error, R, Warns1}, Warns2, _OutFmt) -> {error, R, Warns2++Warns1};
  merge_warns(error, Warns, binary) ->
      erlang:error({internal_error, generated_code_failed_to_compile, Warns}).
  
  possibly_report_warnings(Result, Opts) ->
      Warns = case Result of
  