mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
pb2py: properly handle nested messages and enums
This commit is contained in:
parent
000d832632
commit
1b9b7d6c8e
@ -116,6 +116,8 @@ class Descriptor:
|
||||
for file in self.files:
|
||||
self.messages += file.message_type
|
||||
self.enums += file.enum_type
|
||||
for message in file.message_type:
|
||||
self._nested_types_from_message(message)
|
||||
|
||||
if not self.messages and not self.enums:
|
||||
raise RuntimeError("No messages and no enums found.")
|
||||
@ -125,6 +127,12 @@ class Descriptor:
|
||||
|
||||
self.out_dir = None
|
||||
|
||||
def _nested_types_from_message(self, message):
|
||||
self.messages += message.nested_type
|
||||
self.enums += message.enum_type
|
||||
for nested in message.nested_type:
|
||||
self._nested_types_from_message(nested)
|
||||
|
||||
def find_message_types(self, message_type):
|
||||
message_types = {}
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user