From 8ef0392231c071a92ae78113763c0b1d61eafb1f Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Wed, 7 Jan 2015 18:59:44 +0200 Subject: Fix generator error with OneOfs --- generator/nanopb_generator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'generator/nanopb_generator.py') 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) -- cgit 1.2.3-korg