Print field_val if necessary, and return its message reference. Args: descriptor: The descriptor module from the protobuf package, e.g. google.protobuf.descriptor. field_val: The value of a field, a proto message. registry: an instance of MessageRegistry, used for mapping from
(descriptor, field_val, registry, out)
| 520 | |
| 521 | |
| 522 | def MaybePrintMessageValue(descriptor, field_val, registry, out): |
| 523 | """Print field_val if necessary, and return its message reference. |
| 524 | |
| 525 | Args: |
| 526 | descriptor: The descriptor module from the protobuf package, e.g. |
| 527 | google.protobuf.descriptor. |
| 528 | field_val: The value of a field, a proto message. |
| 529 | registry: an instance of MessageRegistry, used for mapping from |
| 530 | messages to message keys. |
| 531 | out: a list of lines to output (without the newline characters) wrapped as |
| 532 | an OutputFormatter instance, to which this function will append. |
| 533 | Returns: |
| 534 | This object's message reference, e.g. typically the variable name in |
| 535 | validator-generated.js. |
| 536 | """ |
| 537 | message_key = MessageKey(field_val) |
| 538 | if not registry.IsPrinted(message_key): |
| 539 | PrintObject(descriptor, field_val, registry, out) |
| 540 | return registry.MessageReferenceForKey(message_key) |
| 541 | |
| 542 | |
| 543 | def IsTrivialAttrSpec(attr): |
no test coverage detected