@@ -392,6 +392,40 @@ def draw_module(
392392 return structure_text , linkage_text , proc_impl_interfaces , proc_used_interfaces
393393
394394
395+ def _resolve_component_for_view (
396+ need : dict [str , str ], all_needs : dict [str , dict [str , str ]]
397+ ) -> dict [str , str ]:
398+ """Resolve component architecture views to their owning component."""
399+ if need .get ("type" ) != "comp_arc_sta" :
400+ return need
401+
402+ component_ref = need .get ("belongs_to" )
403+ if isinstance (component_ref , list ) and component_ref :
404+ component_id = component_ref [0 ]
405+ if len (component_ref ) > 1 :
406+ logger .info (
407+ f"{ need } : component static view has multiple belongs_to targets, "
408+ f"using only first component: { component_id } "
409+ )
410+
411+ else :
412+ component_id = component_ref
413+ if not component_id :
414+ logger .info (f"{ need } : missing belongs_to for component static view" )
415+ return need
416+
417+ component_need = all_needs .get (component_id , {})
418+ if not component_need :
419+ logger .info (f"{ need } : belongs_to component { component_id } could not be found" )
420+ return need
421+
422+ if component_need .get ("type" ) != "comp" :
423+ logger .info (f"{ need } : belongs_to { component_id } is not a component" )
424+ return need
425+
426+ return component_need
427+
428+
395429# ╭──────────────────────────────────────────────────────────────────────────────╮
396430# │ Classes with hashing to enable caching │
397431# ╰──────────────────────────────────────────────────────────────────────────────╯
@@ -575,16 +609,16 @@ def __repr__(self):
575609 def __call__ (
576610 self , need : dict [str , str ], all_needs : dict [str , dict [str , str ]]
577611 ) -> str :
578- structure_text , linkage_text , _ , _ = draw_comp_incl_impl_int (
579- need , all_needs , dict (), dict (), True
612+ component_need = _resolve_component_for_view (need , all_needs )
613+ structure_text , linkage_text , proc_impl_interfaces , _ = draw_comp_incl_impl_int (
614+ component_need , all_needs , dict (), dict (), True
580615 )
581616
582- # Draw all implemented interfaces outside the boxes
583- local_impl_interfaces = draw_impl_interface (need , all_needs , set ())
584-
585617 # Add all interfaces which are implemented by component to global list
586- # and provide implementation
587- for iface in local_impl_interfaces :
618+ # and provide implementation. Use the interfaces collected during the
619+ # recursive consists_of walk so component drawings also include
620+ # interfaces implemented by nested subcomponents.
621+ for iface in proc_impl_interfaces :
588622 # check for misspelled implements
589623 if not all_needs .get (iface , []):
590624 logger .info (f"{ need } : implements { iface } could not be found" )
0 commit comments