Fixed JS parsing of default map values (#6394)
This commit is contained in:
parent
cb58738de2
commit
dcc8ffd9c6
@ -465,11 +465,15 @@ jspb.Map.prototype.serializeBinary = function(
|
||||
* entries with unset keys is required for maps to be backwards compatible
|
||||
* with the repeated message representation described here: goo.gl/zuoLAC
|
||||
*
|
||||
* @param {V=} opt_defaultValue
|
||||
* The default value for the type of map values.
|
||||
*
|
||||
*/
|
||||
jspb.Map.deserializeBinary = function(map, reader, keyReaderFn, valueReaderFn,
|
||||
opt_valueReaderCallback, opt_defaultKey) {
|
||||
opt_valueReaderCallback, opt_defaultKey,
|
||||
opt_defaultValue) {
|
||||
var key = opt_defaultKey;
|
||||
var value = undefined;
|
||||
var value = opt_defaultValue;
|
||||
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup()) {
|
||||
|
@ -3142,6 +3142,7 @@ void Generator::GenerateClassDeserializeBinaryField(
|
||||
printer->Print(", null");
|
||||
}
|
||||
printer->Print(", $defaultKey$", "defaultKey", JSFieldDefault(key_field));
|
||||
printer->Print(", $defaultValue$", "defaultValue", JSFieldDefault(value_field));
|
||||
printer->Print(");\n");
|
||||
printer->Print(" });\n");
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user