Skip to content

Commit e16595d

Browse files
committed
add a comment for handling undefined COMPARAM-REFs
Also, this only needs to be handled for the locally defined parameters (the leaf nodes of the recursion). Thanks to [at]kayoub5 for inspiring this. Signed-off-by: Andreas Lauser <[email protected]>
1 parent 1afe45b commit e16595d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

odxtools/diaglayers/hierarchyelement.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,13 +518,16 @@ def _compute_available_communication_parameters(self) -> list[ComparamInstance]:
518518
if not isinstance(parent_layer, HierarchyElement):
519519
continue
520520
for cp in parent_layer._compute_available_communication_parameters():
521-
if cp.spec is None:
522-
continue
523521
com_params_dict[(cp.spec_ref.ref_id, cp.protocol_snref)] = cp
524522

525523
# finally, handle the locally defined communication parameters
526524
for cp in getattr(self.hierarchy_element_raw, "comparam_refs", []):
527525
if cp.spec is None:
526+
# discard all COMPARAM-REFs which point to parameters
527+
# that have not been defined. Note that this can only
528+
# happen in non-strict mode since in strict mode an
529+
# exception is raised when resolving ODXLINK
530+
# references.
528531
continue
529532
com_params_dict[(cp.spec_ref.ref_id, cp.protocol_snref)] = cp
530533

0 commit comments

Comments
 (0)