Type hinting cleanup

This commit is contained in:
Alex Mykyta
2025-03-03 21:36:57 -08:00
parent 0258cac186
commit 40687abd6b
13 changed files with 69 additions and 45 deletions

View File

@@ -33,12 +33,12 @@ class Hwif:
self.hwif_report_file = hwif_report_file
if self.ds.reuse_hwif_typedefs:
self._gen_in_cls = InputStructGenerator_TypeScope
self._gen_out_cls = OutputStructGenerator_TypeScope
else:
if not self.ds.reuse_hwif_typedefs:
self._gen_in_cls = InputStructGenerator_Hier
self._gen_out_cls = OutputStructGenerator_Hier
else:
self._gen_in_cls = InputStructGenerator_TypeScope
self._gen_out_cls = OutputStructGenerator_TypeScope
@property
def ds(self) -> 'DesignState':
@@ -158,6 +158,7 @@ class Hwif:
path = get_indexed_path(self.top_node, obj)
return "hwif_in." + path
elif isinstance(obj, PropertyReference):
assert isinstance(obj.node, FieldNode)
return self.get_implied_prop_input_identifier(obj.node, obj.name)
raise RuntimeError(f"Unhandled reference to: {obj}")
@@ -210,6 +211,7 @@ class Hwif:
# not sure when anything would call this function with a prop ref
# when dereferencer's get_value is more useful here
assert obj.node.get_property(obj.name)
assert isinstance(obj.node, (RegNode, FieldNode))
return self.get_implied_prop_output_identifier(obj.node, obj.name)
raise RuntimeError(f"Unhandled reference to: {obj}")