3434
3535tbd.
3636"""
37- from typing import List , Dict , Iterable , Optional as Nullable
37+ from typing import List , Dict , Iterable , Optional as Nullable , Any
3838
3939from pyTooling .Decorators import export , readonly
4040from pyTooling .MetaClasses import ExtendedType
@@ -61,6 +61,7 @@ class ConcurrentDeclarationRegionMixin(metaclass=ExtendedType, mixin=True):
6161 # _subprograms: Dict[str, Dict[str, Subprogram]] #: Dictionary of all subprograms declared in this concurrent declaration region.
6262 _functions : Dict [str , Dict [str , Function ]] #: Dictionary of all functions declared in this concurrent declaration region.
6363 _procedures : Dict [str , Dict [str , Procedure ]] #: Dictionary of all procedures declared in this concurrent declaration region.
64+ _components : Dict [str , Any ] #: Dictionary of all components declared in this concurrent declaration region.
6465
6566 def __init__ (self , declaredItems : Nullable [Iterable ] = None ) -> None :
6667 # TODO: extract to mixin
@@ -80,6 +81,7 @@ def __init__(self, declaredItems: Nullable[Iterable] = None) -> None:
8081 # self._subprograms = {}
8182 self ._functions = {}
8283 self ._procedures = {}
84+ self ._components = {}
8385
8486 @readonly
8587 def DeclaredItems (self ) -> List :
@@ -125,6 +127,10 @@ def Functions(self) -> Dict[str, Dict[str, Function]]:
125127 def Procedures (self ) -> Dict [str , Dict [str , Procedure ]]:
126128 return self ._procedures
127129
130+ @readonly
131+ def Components (self ) -> Dict [str , Any ]:
132+ return self ._components
133+
128134 def IndexDeclaredItems (self ) -> None :
129135 """
130136 Index declared items listed in the concurrent declaration region.
@@ -155,6 +161,8 @@ def IndexDeclaredItems(self) -> None:
155161 :meth:`pyVHDLModel.Library._IndexOtherDeclaredItem`
156162 Iterate all packages in the library and index declared items.
157163 """
164+ from pyVHDLModel .DesignUnit import Component
165+
158166 for item in self ._declaredItems :
159167 if isinstance (item , FullType ):
160168 self ._types [item ._normalizedIdentifier ] = item
@@ -187,6 +195,9 @@ def IndexDeclaredItems(self) -> None:
187195 for normalizedIdentifier in item ._normalizedIdentifiers :
188196 self ._files [normalizedIdentifier ] = item
189197 self ._namespace ._elements [normalizedIdentifier ] = item
198+ elif isinstance (item , Component ):
199+ self ._components [item ._normalizedIdentifier ] = item
200+ self ._namespace ._elements [item ._normalizedIdentifier ] = item
190201 else :
191202 self ._IndexOtherDeclaredItem (item )
192203
0 commit comments