diff options
Diffstat (limited to 'generator')
-rwxr-xr-x | generator/nanopb_generator.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py index 066ef936..a2ee22db 100755 --- a/generator/nanopb_generator.py +++ b/generator/nanopb_generator.py @@ -285,7 +285,7 @@ class Field: can_be_static = False else: self.array_decl = '[%d]' % self.max_count - elif field_options.HasField("proto3"): + elif field_options.proto3: self.rules = 'SINGULAR' elif desc.label == FieldD.LABEL_REQUIRED: self.rules = 'REQUIRED' @@ -1373,6 +1373,9 @@ def get_nanopb_suboptions(subdesc, options, name): new_options = nanopb_pb2.NanoPBOptions() new_options.CopyFrom(options) + if hasattr(subdesc, 'syntax') and subdesc.syntax == "proto3": + new_options.proto3 = True + # Handle options defined in a separate file dotname = '.'.join(name.parts) for namemask, options in Globals.separate_options: @@ -1380,9 +1383,6 @@ def get_nanopb_suboptions(subdesc, options, name): Globals.matched_namemasks.add(namemask) new_options.MergeFrom(options) - if hasattr(subdesc, 'syntax') and subdesc.syntax == "proto3": - new_options.proto3 = True - # Handle options defined in .proto if isinstance(subdesc.options, descriptor.FieldOptions): ext_type = nanopb_pb2.nanopb |