@@ -3266,7 +3266,7 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options,
3266
3266
// TODO(cfallin): Handle lazy decoding when requested by field option and/or
3267
3267
// by default for 'bytes' fields and packed repeated fields.
3268
3268
3269
- const std::string classSymbol = GetMessagePath (options, desc);
3269
+ const std::string classSymbol = desc-> name ( );
3270
3270
3271
3271
printer->Print (
3272
3272
" /**\n "
@@ -3275,12 +3275,12 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options,
3275
3275
" * @return {!$class$}\n "
3276
3276
" */\n " ,
3277
3277
" class" , classSymbol);
3278
- GenerateMethodStart (options, printer, classSymbol.c_str (), " deserializeBinary" );
3279
3278
printer->Print (
3280
- " (bytes) {\n "
3279
+ " $methodstart$ (bytes) {\n "
3281
3280
" var reader = new jspb.BinaryReader(bytes);\n "
3282
3281
" var msg = new $class$;\n "
3283
3282
" return $class$.deserializeBinaryFromReader(msg, reader);\n " ,
3283
+ " methodstart" , this ->MethodStartStatic (options, classSymbol.c_str (), " deserializeBinary" ),
3284
3284
" class" , classSymbol);
3285
3285
3286
3286
GenerateMethodEnd (options, printer);
@@ -3297,15 +3297,15 @@ printer->Print(
3297
3297
" * @return {!$class$}\n "
3298
3298
" */\n " ,
3299
3299
" class" , classSymbol);
3300
- GenerateMethodStart (options, printer, classSymbol.c_str (), " deserializeBinaryFromReader" );
3301
3300
printer->Print (
3302
- " (msg, reader) {\n "
3301
+ " $methodstart$ (msg, reader) {\n "
3303
3302
" while (reader.nextField()) {\n "
3304
3303
" if (reader.isEndGroup()) {\n "
3305
3304
" break;\n "
3306
3305
" }\n "
3307
3306
" var field = reader.getFieldNumber();\n "
3308
- " switch (field) {\n " );
3307
+ " switch (field) {\n " ,
3308
+ " methodstart" , MethodStartStatic (options, classSymbol.c_str (), " deserializeBinaryFromReader" ));
3309
3309
3310
3310
for (int i = 0 ; i < desc->field_count (); i++) {
3311
3311
if (!IgnoreField (desc->field (i))) {
@@ -3442,19 +3442,19 @@ void Generator::GenerateClassSerializeBinary(const GeneratorOptions& options,
3442
3442
io::Printer* printer,
3443
3443
const Descriptor* desc) const {
3444
3444
3445
- const std::string classSymbol = GetMessagePath (options, desc);
3445
+ const std::string classSymbol = desc-> name ( );
3446
3446
3447
3447
printer->Print (
3448
3448
" /**\n "
3449
3449
" * Serializes the message to binary data (in protobuf wire format).\n "
3450
3450
" * @return {!Uint8Array}\n "
3451
3451
" */\n " );
3452
- GenerateMethodStart (options, printer, classSymbol.c_str (), " serializeBinary" );
3453
3452
printer->Print (
3454
- " () {\n "
3453
+ " $methodstart$ () {\n "
3455
3454
" var writer = new jspb.BinaryWriter();\n "
3456
- " $class$ .serializeBinaryToWriter(this, writer);\n "
3455
+ " this.constructor .serializeBinaryToWriter(this, writer);\n "
3457
3456
" return writer.getResultBuffer();\n " ,
3457
+ " methodstart" , MethodStart (options, classSymbol.c_str (), " serializeBinary" ),
3458
3458
" class" , classSymbol);
3459
3459
3460
3460
GenerateMethodEnd (options, printer);
@@ -3468,12 +3468,11 @@ void Generator::GenerateClassSerializeBinary(const GeneratorOptions& options,
3468
3468
" * @param {!$class$} message\n "
3469
3469
" * @param {!jspb.BinaryWriter} writer\n "
3470
3470
" * @suppress {unusedLocalVariables} f is only used for nested messages\n "
3471
- " */\n " ,
3471
+ " */\n "
3472
+ " $methodstart$(message, writer) {\n "
3473
+ " var f = undefined;\n " ,
3474
+ " methodstart" , MethodStartStatic (options, classSymbol.c_str (), " serializeBinaryToWriter" ),
3472
3475
" class" , classSymbol);
3473
- GenerateMethodStart (options, printer, classSymbol.c_str (), " serializeBinaryToWriter" );
3474
- printer->Print (
3475
- " (message, writer) {\n "
3476
- " var f = undefined;\n " );
3477
3476
3478
3477
for (int i = 0 ; i < desc->field_count (); i++) {
3479
3478
if (!IgnoreField (desc->field (i))) {
0 commit comments