function genValuePartial_toObject(gen, field, fieldIndex, prop) {
        /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
        if (field.resolvedType) {
          if (field.resolvedType instanceof Enum)
            gen(
              "d%s=o.enums===String?types[%i].values[m%s]:m%s",
              prop,
              fieldIndex,
              prop,
              prop
            );
          else gen("d%s=types[%i].toObject(m%s,o)", prop, fieldIndex, prop);
        } else {
          var isUnsigned = false;
          switch (field.type) {
            case "double":
            case "float":
              gen(
                "d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",
                prop,
                prop,
                prop,
                prop
              );
              break;
            case "uint64":
              isUnsigned = true;
            // eslint-disable-line no-fallthrough
            case "int64":
            case "sint64":
            case "fixed64":
            case "sfixed64":
              gen('if(typeof m%s==="number")', prop)(
                "d%s=o.longs===String?String(m%s):m%s",
                prop,
                prop,
                prop
              )("else")(
                // Long-like
                "d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",
                prop,
                prop,
                prop,
                prop,
                isUnsigned ? "true" : "",
                prop
              );
              break;
            case "bytes":
              gen(
                "d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",
                prop,
                prop,
                prop,
                prop,
                prop
              );
              break;
            default:
              gen("d%s=m%s", prop, prop);
              break;
          }
        }
        return gen;
        /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */
      }
/**
       * Generates a partial value toObject converter.
       * @param {Codegen} gen Codegen instance
       * @param {Field} field Reflected field
       * @param {number} fieldIndex Field index
       * @param {string} prop Property reference
       * @returns {Codegen} Codegen instance
       * @ignore
       */
Generates a partial value toObject converter.
Generates a partial value toObject converter .
function genValuePartial_toObject(gen, field, fieldIndex, prop) {
        if (field.resolvedType) {
          if (field.resolvedType instanceof Enum)
            gen(
              "d%s=o.enums===String?types[%i].values[m%s]:m%s",
              prop,
              fieldIndex,
              prop,
              prop
            );
          else gen("d%s=types[%i].toObject(m%s,o)", prop, fieldIndex, prop);
        } else {
          var isUnsigned = false;
          switch (field.type) {
            case "double":
            case "float":
              gen(
                "d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",
                prop,
                prop,
                prop,
                prop
              );
              break;
            case "uint64":
              isUnsigned = true;
            case "int64":
            case "sint64":
            case "fixed64":
            case "sfixed64":
              gen('if(typeof m%s==="number")', prop)(
                "d%s=o.longs===String?String(m%s):m%s",
                prop,
                prop,
                prop
              )("else")(
                "d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",
                prop,
                prop,
                prop,
                prop,
                isUnsigned ? "true" : "",
                prop
              );
              break;
            case "bytes":
              gen(
                "d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",
                prop,
                prop,
                prop,
                prop,
                prop
              );
              break;
            default:
              gen("d%s=m%s", prop, prop);
              break;
          }
        }
        return gen;
      }
function genValuePartial_toObject ( gen , field , fieldIndex , prop ) { if ( field . resolvedType ) { if ( field . resolvedType instanceof Enum ) gen ( "d%s=o.enums===String?types[%i].values[m%s]:m%s" , prop , fieldIndex , prop , prop ) ; else gen ( "d%s=types[%i].toObject(m%s,o)" , prop , fieldIndex , prop ) ; } else { var isUnsigned = false ; switch ( field . type ) { case "double" : case "float" : gen ( "d%s=o.json&&!isFinite(m%s)?String(m%s):m%s" , prop , prop , prop , prop ) ; break ; case "uint64" : isUnsigned = true ; case "int64" : case "sint64" : case "fixed64" : case "sfixed64" : gen ( 'if(typeof m%s==="number")' , prop ) ( "d%s=o.longs===String?String(m%s):m%s" , prop , prop , prop ) ( "else" ) ( "d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s" , prop , prop , prop , prop , isUnsigned ? "true" : "" , prop ) ; break ; case "bytes" : gen ( "d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s" , prop , prop , prop , prop , prop ) ; break ; default : gen ( "d%s=m%s" , prop , prop ) ; break ; } } return gen ; }
Generates a partial value toObject converter.
Generates a partial value toObject converter .
/* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ // eslint-disable-line no-fallthrough // Long-like /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */