Skip to content

Commit dba295a

Browse files
authored
Update parse.js
Added support for turning on the packed option manually.
1 parent 75bc576 commit dba295a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/parse.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ function parse(source, root, options) {
336336
field.comment = cmnt(trailingLine);
337337
// JSON defaults to packed=true if not set so we have to set packed=false explicity when
338338
// parsing proto2 descriptors without the option, where applicable.
339-
if (field.repeated && !isProto3)
339+
var packed = field.getOption('packed');
340+
if (field.repeated && packed === undefined && !isProto3)
340341
field.setOption("packed", false, /* ifNotSet */ true);
341342
parent.add(field);
342343
}

0 commit comments

Comments
 (0)