Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
dcc8ffd9
Commit
dcc8ffd9
authored
Jul 24, 2019
by
Lian Duan
Committed by
Paul Yang
Jul 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed JS parsing of default map values (#6394)
parent
cb58738d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
map.js
js/map.js
+6
-2
js_generator.cc
src/google/protobuf/compiler/js/js_generator.cc
+1
-0
No files found.
js/map.js
View file @
dcc8ffd9
...
...
@@ -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
())
{
...
...
src/google/protobuf/compiler/js/js_generator.cc
View file @
dcc8ffd9
...
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment