diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2015-01-07 18:59:44 +0200 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2015-01-07 18:59:44 +0200 |
commit | 8ef0392231c071a92ae78113763c0b1d61eafb1f (patch) | |
tree | bacd1a27238275d35a050f6a76493207b79af785 /generator/nanopb_generator.py | |
parent | fa444be4243b2e1f0f6ee22798ddbf0c85e54422 (diff) |
Fix generator error with OneOfs
Diffstat (limited to 'generator/nanopb_generator.py')
-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) |