protobufjs 7.2.1 → 7.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/light/protobuf.js +6 -2
- package/dist/light/protobuf.js.map +1 -1
- package/dist/light/protobuf.min.js +3 -3
- package/dist/light/protobuf.min.js.map +1 -1
- package/dist/minimal/protobuf.js +2 -2
- package/dist/minimal/protobuf.min.js +2 -2
- package/dist/protobuf.js +16 -2
- package/dist/protobuf.js.map +1 -1
- package/dist/protobuf.min.js +3 -3
- package/dist/protobuf.min.js.map +1 -1
- package/package.json +1 -1
- package/src/parse.js +10 -0
- package/src/root.js +4 -0
package/package.json
CHANGED
package/src/parse.js
CHANGED
|
@@ -360,6 +360,16 @@ function parse(source, root, options) {
|
|
|
360
360
|
parseGroup(parent, rule);
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
|
+
// Type names can consume multiple tokens, in multiple variants:
|
|
364
|
+
// package.subpackage field tokens: "package.subpackage" [TYPE NAME ENDS HERE] "field"
|
|
365
|
+
// package . subpackage field tokens: "package" "." "subpackage" [TYPE NAME ENDS HERE] "field"
|
|
366
|
+
// package. subpackage field tokens: "package." "subpackage" [TYPE NAME ENDS HERE] "field"
|
|
367
|
+
// package .subpackage field tokens: "package" ".subpackage" [TYPE NAME ENDS HERE] "field"
|
|
368
|
+
// Keep reading tokens until we get a type name with no period at the end,
|
|
369
|
+
// and the next token does not start with a period.
|
|
370
|
+
while (type.endsWith(".") || peek().startsWith(".")) {
|
|
371
|
+
type += next();
|
|
372
|
+
}
|
|
363
373
|
|
|
364
374
|
/* istanbul ignore if */
|
|
365
375
|
if (!typeRefRe.test(type))
|
package/src/root.js
CHANGED
|
@@ -274,6 +274,10 @@ function tryHandleExtension(root, field) {
|
|
|
274
274
|
var extendedType = field.parent.lookup(field.extend);
|
|
275
275
|
if (extendedType) {
|
|
276
276
|
var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options);
|
|
277
|
+
//do not allow to extend same field twice to prevent the error
|
|
278
|
+
if (extendedType.get(sisterField.name)) {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
277
281
|
sisterField.declaringField = field;
|
|
278
282
|
field.extensionField = sisterField;
|
|
279
283
|
extendedType.add(sisterField);
|