diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2012-11-14 00:43:51 +0200 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2012-11-14 00:43:51 +0200 |
commit | 0abb764b1816e6a986c10c30444530e11d112cb1 (patch) | |
tree | 9f3ffc343095595b3f6391e7cf9cc8c3c7a01ca2 /generator | |
parent | 02ecee2de89f3225a6cd4bf87b0e4285bb1d06eb (diff) |
Fix naming of nested Enums with short names
Diffstat (limited to 'generator')
-rw-r--r-- | generator/nanopb_generator.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py index 68cc800c..6aac1b8c 100644 --- a/generator/nanopb_generator.py +++ b/generator/nanopb_generator.py @@ -92,9 +92,9 @@ class Enum: if enum_options.long_names: self.values = [(self.names + x.name, x.number) for x in desc.value] else: - self.values = [(x.name, x.number) for x in desc.value] + self.values = [(names + x.name, x.number) for x in desc.value] - self.value_longnames = [names + desc.name + x.name for x in desc.value] + self.value_longnames = [self.names + x.name for x in desc.value] def __str__(self): result = 'typedef enum _%s {\n' % self.names @@ -395,7 +395,8 @@ def parse_file(fdesc, file_options): message_options = get_nanopb_suboptions(message, file_options) messages.append(Message(names, message, message_options)) for enum in message.enum_type: - enums.append(Enum(names, enum, message_options)) + enum_options = get_nanopb_suboptions(enum, message_options) + enums.append(Enum(names, enum, enum_options)) # Fix field default values where enum short names are used. for enum in enums: |