Skip to content

Commit

Permalink
Update parse.js
Browse files Browse the repository at this point in the history
This check is wrong as the types.packed fields includes only the built in primitive types. But at this point type of the repeated enum is a custom type like test.TestMessage therefore types.packed[type] !== undefined always returns false and code never enters that if condition and it does not set the packed flag to false. However when the syntax is set to proto2 this flag should be always set to false.
  • Loading branch information
serkangunes authored Feb 20, 2017
1 parent 2ddb76b commit 75bc576
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ function parse(source, root, options) {
field.comment = cmnt(trailingLine);
// JSON defaults to packed=true if not set so we have to set packed=false explicity when
// parsing proto2 descriptors without the option, where applicable.
if (field.repeated && types.packed[type] !== undefined && !isProto3)
if (field.repeated && !isProto3)
field.setOption("packed", false, /* ifNotSet */ true);
parent.add(field);
}
Expand Down

0 comments on commit 75bc576

Please sign in to comment.