diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2017-09-13 14:23:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-13 14:23:59 -0700 |
commit | 8741da3e45876f8c55ca062a08726f542f646423 (patch) | |
tree | 817ec4f768f008b6016d4b787f378bbb09eff814 /src/google/protobuf/compiler/js/js_generator.cc | |
parent | 2bd55a9fbcd2815b3332bf309bc20f59eef0b36b (diff) | |
download | protobuf-8741da3e45876f8c55ca062a08726f542f646423.tar.gz protobuf-8741da3e45876f8c55ca062a08726f542f646423.tar.bz2 protobuf-8741da3e45876f8c55ca062a08726f542f646423.zip |
Revert "Fix js conformance tests. (#3604)" (#3633)
This reverts commit 2bd55a9fbcd2815b3332bf309bc20f59eef0b36b.
Diffstat (limited to 'src/google/protobuf/compiler/js/js_generator.cc')
-rwxr-xr-x | src/google/protobuf/compiler/js/js_generator.cc | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/src/google/protobuf/compiler/js/js_generator.cc b/src/google/protobuf/compiler/js/js_generator.cc index a25de76c..73d32762 100755 --- a/src/google/protobuf/compiler/js/js_generator.cc +++ b/src/google/protobuf/compiler/js/js_generator.cc @@ -2876,29 +2876,6 @@ void Generator::GenerateClassDeserializeBinaryField( "Group" : "Message", "grpfield", (field->type() == FieldDescriptor::TYPE_GROUP) ? (SimpleItoa(field->number()) + ", ") : ""); - } else if (field->is_repeated() && - field->cpp_type() != FieldDescriptor::CPPTYPE_STRING) { - printer->Print( - " if (reader.getWireType() == 2) {\n" - " var value = /** @type {$fieldtype_packed$} */ " - "(reader.readPacked$reader$());\n" - " msg.set$list_name$(value);\n" - " } else {\n" - " var value = /** @type {$fieldtype$} */ " - "(reader.read$reader$());\n" - " msg.add$name$(value);\n" - " }\n", - "fieldtype_packed", JSFieldTypeAnnotation(options, field, false, true, - /* singular_if_not_packed */ false, - BYTES_U8), - "fieldtype", JSFieldTypeAnnotation(options, field, false, true, - /* singular_if_not_packed */ true, - BYTES_U8), - "reader", JSBinaryReaderMethodType(field), - "list_name", JSGetterName(options, field), - "name", JSGetterName(options, field, - BYTES_DEFAULT, /* drop_list = */ true) - ); } else { printer->Print( " var value = /** @type {$fieldtype$} */ " @@ -2910,15 +2887,14 @@ void Generator::GenerateClassDeserializeBinaryField( JSBinaryReadWriteMethodName(field, /* is_writer = */ false)); } - if (field->is_repeated() && - (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE || - field->cpp_type() == FieldDescriptor::CPPTYPE_STRING)) { + if (field->is_repeated() && !field->is_packed()) { printer->Print( " msg.add$name$(value);\n", "name", JSGetterName(options, field, BYTES_DEFAULT, /* drop_list = */ true)); - } else if (!field->is_repeated()) { - // Singular fields, receive a |value| as the field's value ; set this as - // the field's value directly. + } else { + // Singular fields, and packed repeated fields, receive a |value| either + // as the field's value or as the array of all the field's values; set + // this as the field's value directly. printer->Print( " msg.set$name$(value);\n", "name", JSGetterName(options, field)); |