diff options
-rwxr-xr-x | generator/nanopb_generator.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py index 2a9ae008..3f309a4d 100755 --- a/generator/nanopb_generator.py +++ b/generator/nanopb_generator.py @@ -582,7 +582,8 @@ class ExtensionField(Field): # --------------------------------------------------------------------------- class OneOf(Field): - def __init__(self, oneof_desc): + def __init__(self, struct_name, oneof_desc): + self.struct_name = struct_name self.name = oneof_desc.name self.ctype = 'union' self.fields = [] @@ -655,7 +656,7 @@ class Message: if hasattr(desc, 'oneof_decl'): for f in desc.oneof_decl: - oneof = OneOf(f) + oneof = OneOf(self.name, f) self.oneofs.append(oneof) self.fields.append(oneof) |