diff options
-rw-r--r-- | pyGHDL/dom/DesignUnit.py | 11 | ||||
-rw-r--r-- | pyGHDL/dom/Symbol.py | 15 | ||||
-rw-r--r-- | pyGHDL/dom/formatting/GraphML.py | 2 | ||||
-rw-r--r-- | testsuite/pyunit/dom/Expressions.py | 4 |
4 files changed, 22 insertions, 10 deletions
diff --git a/pyGHDL/dom/DesignUnit.py b/pyGHDL/dom/DesignUnit.py index 48ae24b6f..edca0789e 100644 --- a/pyGHDL/dom/DesignUnit.py +++ b/pyGHDL/dom/DesignUnit.py @@ -66,13 +66,14 @@ from pyGHDL.dom import DOMMixin, Position, DOMException from pyGHDL.dom._Utils import GetNameOfNode, GetDocumentationOfNode from pyGHDL.dom._Translate import GetGenericsFromChainedNodes, GetPortsFromChainedNodes, GetName from pyGHDL.dom._Translate import GetDeclaredItemsFromChainedNodes, GetConcurrentStatementsFromChainedNodes -from pyGHDL.dom.Names import SimpleName +from pyGHDL.dom.Names import SimpleName, AllName from pyGHDL.dom.Symbol import ( EntitySymbol, ContextReferenceSymbol, LibraryReferenceSymbol, PackageSymbol, PackageMemberReferenceSymbol, + AllPackageMembersReferenceSymbol ) @@ -92,10 +93,14 @@ class UseClause(VHDLModel_UseClause, DOMMixin): @classmethod def parse(cls, useNode: Iir): nameNode = nodes.Get_Selected_Name(useNode) - uses = [PackageMemberReferenceSymbol(nameNode, GetName(nameNode))] + name = GetName(nameNode) + symbolType = AllPackageMembersReferenceSymbol if isinstance(name, AllName) else PackageMemberReferenceSymbol + uses = [symbolType(nameNode, name)] for use in utils.chain_iter(nodes.Get_Use_Clause_Chain(useNode)): nameNode = nodes.Get_Selected_Name(use) - uses.append(PackageMemberReferenceSymbol(nameNode, GetName(nameNode))) + name = GetName(nameNode) + symbolType = AllPackageMembersReferenceSymbol if isinstance(name, AllName) else PackageMemberReferenceSymbol + uses.append(symbolType(nameNode, name)) return cls(useNode, uses) diff --git a/pyGHDL/dom/Symbol.py b/pyGHDL/dom/Symbol.py index 456c96847..05057793d 100644 --- a/pyGHDL/dom/Symbol.py +++ b/pyGHDL/dom/Symbol.py @@ -38,7 +38,8 @@ from pyVHDLModel import Name from pyVHDLModel.Base import ExpressionUnion from pyVHDLModel.Symbol import LibraryReferenceSymbol as VHDLModel_LibraryReferenceSymbol from pyVHDLModel.Symbol import PackageReferenceSymbol as VHDLModel_PackageReferenceSymbol -from pyVHDLModel.Symbol import PackageMembersReferenceSymbol as VHDLModel_PackageMembersReferenceSymbol +from pyVHDLModel.Symbol import PackageMemberReferenceSymbol as VHDLModel_PackageMemberReferenceSymbol +from pyVHDLModel.Symbol import AllPackageMembersReferenceSymbol as VHDLModel_AllPackageMembersReferenceSymbol from pyVHDLModel.Symbol import ContextReferenceSymbol as VHDLModel_ContextReferenceSymbol from pyVHDLModel.Symbol import EntitySymbol as VHDLModel_EntitySymbol from pyVHDLModel.Symbol import ArchitectureSymbol as VHDLModel_ArchitectureSymbol @@ -82,8 +83,16 @@ class ContextReferenceSymbol(VHDLModel_ContextReferenceSymbol, DOMMixin): @export -class PackageMemberReferenceSymbol(VHDLModel_PackageMembersReferenceSymbol, DOMMixin): - @InheritDocString(VHDLModel_PackageMembersReferenceSymbol) +class PackageMemberReferenceSymbol(VHDLModel_PackageMemberReferenceSymbol, DOMMixin): + @InheritDocString(VHDLModel_PackageMemberReferenceSymbol) + def __init__(self, identifierNode: Iir, name: Name): + super().__init__(name) + DOMMixin.__init__(self, identifierNode) + + +@export +class AllPackageMembersReferenceSymbol(VHDLModel_AllPackageMembersReferenceSymbol, DOMMixin): + @InheritDocString(VHDLModel_AllPackageMembersReferenceSymbol) def __init__(self, identifierNode: Iir, name: Name): super().__init__(name) DOMMixin.__init__(self, identifierNode) diff --git a/pyGHDL/dom/formatting/GraphML.py b/pyGHDL/dom/formatting/GraphML.py index 7f72d54b5..0ad31e33f 100644 --- a/pyGHDL/dom/formatting/GraphML.py +++ b/pyGHDL/dom/formatting/GraphML.py @@ -91,7 +91,7 @@ class DependencyGraphFormatter: for vertex in vertices: if vertex["kind"] is DependencyGraphVertexKind.Architecture: - value = f"{vertex.Value.Entity.Identifier}({vertex.Value.Identifier})" + value = f"{vertex.Value.Entity.Name.Identifier}({vertex.Value.Identifier})" elif vertex["kind"] is DependencyGraphVertexKind.Document: value = f"{vertex.ID}" else: diff --git a/testsuite/pyunit/dom/Expressions.py b/testsuite/pyunit/dom/Expressions.py index 290216156..24235e1e1 100644 --- a/testsuite/pyunit/dom/Expressions.py +++ b/testsuite/pyunit/dom/Expressions.py @@ -84,9 +84,7 @@ class Expressions(TestCase): return default def test_NotExpression(self): - filename: Path = self._root / "{className}_{funcName}.vhdl".format( - className=self.__class__.__name__, funcName= currentframe().f_code.co_name[5:] - ) + filename: Path = self._root / f"{self.__class__.__name__}_{currentframe().f_code.co_name[5:]}.vhdl" # Define test data constantDeclartion = "constant c0 : boolean := not True;" |