aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-10-24 21:10:09 -0500
committermat <github@matdoes.dev>2022-10-24 21:10:09 -0500
commitf38d0660d16364cc4d6a720889acee68441b28fd (patch)
treea0d5587d76da88bbf7610b49f970460ce808ea29
parent0d55c71ceef9893025fabeee1b7cccb3ffeeb4ec (diff)
downloadazalea-drasl-f38d0660d16364cc4d6a720889acee68441b28fd.tar.xz
fix codegen
-rw-r--r--codegen/lib/code/utils.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/codegen/lib/code/utils.py b/codegen/lib/code/utils.py
index d91e0634..635dff0b 100644
--- a/codegen/lib/code/utils.py
+++ b/codegen/lib/code/utils.py
@@ -80,8 +80,14 @@ def burger_type_to_rust_type(burger_type, field_name: Optional[str] = None, inst
enum_first_part_name)
print('enum_first_part_obfuscated_name',
enum_first_part_obfuscated_name)
- enum_name = mappings.get_method_type(
- enum_first_part_obfuscated_name, enum_field.split('.')[1].split('(')[0], '')
+ print('enum field', enum_field.split('.')[1].split('(')[0])
+ try:
+ enum_name = mappings.get_method_type(
+ enum_first_part_obfuscated_name, enum_field.split('.')[1].split('(')[0], '')
+ except KeyError:
+ # sometimes enums are fields instead of methods
+ enum_name = mappings.get_field_type(
+ enum_first_part_obfuscated_name, enum_field.split('.')[1].split('(')[0])
print('hm', enum_name)
else:
@@ -158,6 +164,5 @@ def clean_property_name(property_name):
# `type` is a reserved keyword, so we use kind instead ¯\_(ツ)_/¯
if property_name == 'type':
property_name = 'kind'
-
- return property_name
+ return property_name