diff options
Diffstat (limited to 'pyGHDL')
-rw-r--r-- | pyGHDL/dom/DesignUnit.py | 18 | ||||
-rw-r--r-- | pyGHDL/dom/Symbol.py | 17 | ||||
-rw-r--r-- | pyGHDL/dom/formatting/prettyprint.py | 2 |
3 files changed, 21 insertions, 16 deletions
diff --git a/pyGHDL/dom/DesignUnit.py b/pyGHDL/dom/DesignUnit.py index 8ccdb91bb..054fe0e7b 100644 --- a/pyGHDL/dom/DesignUnit.py +++ b/pyGHDL/dom/DesignUnit.py @@ -77,7 +77,7 @@ from pyGHDL.dom._Translate import ( GetConcurrentStatementsFromChainedNodes, ) from pyGHDL.dom.Names import SimpleName -from pyGHDL.dom.Symbol import EntitySymbol, ContextReferenceSymbol, LibraryReferenceSymbol +from pyGHDL.dom.Symbol import EntitySymbol, ContextReferenceSymbol, LibraryReferenceSymbol, PackageSymbol @export @@ -171,8 +171,7 @@ class Architecture(VHDLModel_Architecture, DOMMixin): name = GetNameOfNode(architectureNode) documentation = GetDocumentationOfNode(architectureNode) entityNameNode = nodes.Get_Entity_Name(architectureNode) - entityName = GetNameOfNode(entityNameNode) - entitySymbol = EntitySymbol(entityNameNode, SimpleName(entityNameNode, entityName)) + entitySymbol = EntitySymbol(entityNameNode, GetNameOfNode(entityNameNode)) declaredItems = GetDeclaredItemsFromChainedNodes( nodes.Get_Declaration_Chain(architectureNode), "architecture", name ) @@ -245,23 +244,24 @@ class PackageBody(VHDLModel_PackageBody, DOMMixin): def __init__( self, node: Iir, - identifier: str, + packageSymbol: PackageSymbol, contextItems: Iterable[VHDLModel_ContextUnion] = None, declaredItems: Iterable = None, documentation: str = None, ): - super().__init__(identifier, contextItems, declaredItems, documentation) + super().__init__(packageSymbol, contextItems, declaredItems, documentation) DOMMixin.__init__(self, node) @classmethod def parse(cls, packageBodyNode: Iir, contextItems: Iterable[VHDLModel_ContextUnion]): - name = GetNameOfNode(packageBodyNode) + packageName = GetNameOfNode(packageBodyNode) + packageSymbol = PackageSymbol(packageBodyNode, packageName) documentation = GetDocumentationOfNode(packageBodyNode) - declaredItems = GetDeclaredItemsFromChainedNodes(nodes.Get_Declaration_Chain(packageBodyNode), "package", name) + declaredItems = GetDeclaredItemsFromChainedNodes(nodes.Get_Declaration_Chain(packageBodyNode), "package", packageName) # FIXME: read use clauses - return cls(packageBodyNode, name, contextItems, declaredItems, documentation) + return cls(packageBodyNode, packageSymbol, contextItems, declaredItems, documentation) @export @@ -297,7 +297,7 @@ class Context(VHDLModel_Context, DOMMixin): self, node: Iir, identifier: str, - references: Iterable[Union[LibraryClause, UseClause]] = None, + references: Iterable[Union[LibraryClause, UseClause, ContextReference]] = None, documentation: str = None, ): super().__init__(identifier, references, documentation) diff --git a/pyGHDL/dom/Symbol.py b/pyGHDL/dom/Symbol.py index ed1acb7b1..40d877c3f 100644 --- a/pyGHDL/dom/Symbol.py +++ b/pyGHDL/dom/Symbol.py @@ -59,6 +59,7 @@ from pyGHDL.dom.Range import Range @export class LibraryReferenceSymbol(VHDLModel_LibraryReferenceSymbol, DOMMixin): + @InheritDocString(VHDLModel_LibraryReferenceSymbol) def __init__(self, libraryNode: Iir, identifier: str): super().__init__(identifier) DOMMixin.__init__(self, libraryNode) @@ -66,6 +67,7 @@ class LibraryReferenceSymbol(VHDLModel_LibraryReferenceSymbol, DOMMixin): @export class PackageReferenceSymbol(VHDLModel_PackageReferenceSymbol, DOMMixin): + @InheritDocString(VHDLModel_PackageReferenceSymbol) def __init__(self, libraryNode: Iir, identifier: str, prefix: LibraryReferenceSymbol): super().__init__(identifier, prefix) DOMMixin.__init__(self, libraryNode) @@ -73,6 +75,7 @@ class PackageReferenceSymbol(VHDLModel_PackageReferenceSymbol, DOMMixin): @export class PackageMembersReferenceSymbol(VHDLModel_PackageMembersReferenceSymbol, DOMMixin): + @InheritDocString(VHDLModel_PackageMembersReferenceSymbol) def __init__(self, libraryNode: Iir, identifier: str, prefix: PackageReferenceSymbol): super().__init__(identifier, prefix) DOMMixin.__init__(self, libraryNode) @@ -80,6 +83,7 @@ class PackageMembersReferenceSymbol(VHDLModel_PackageMembersReferenceSymbol, DOM @export class AllPackageMembersReferenceSymbol(VHDLModel_AllPackageMembersReferenceSymbol, DOMMixin): + @InheritDocString(VHDLModel_AllPackageMembersReferenceSymbol) def __init__(self, libraryNode: Iir, prefix: PackageReferenceSymbol): super().__init__(prefix) DOMMixin.__init__(self, libraryNode) @@ -87,6 +91,7 @@ class AllPackageMembersReferenceSymbol(VHDLModel_AllPackageMembersReferenceSymbo @export class ContextReferenceSymbol(VHDLModel_ContextReferenceSymbol, DOMMixin): + @InheritDocString(VHDLModel_ContextReferenceSymbol) def __init__(self, libraryNode: Iir, identifier: str, prefix: LibraryReferenceSymbol): super().__init__(identifier, prefix) DOMMixin.__init__(self, libraryNode) @@ -95,24 +100,24 @@ class ContextReferenceSymbol(VHDLModel_ContextReferenceSymbol, DOMMixin): @export class EntitySymbol(VHDLModel_EntitySymbol, DOMMixin): @InheritDocString(VHDLModel_EntitySymbol) - def __init__(self, node: Iir, entityName: SimpleName): - super().__init__(entityName) + def __init__(self, node: Iir, identifier: str): + super().__init__(identifier) DOMMixin.__init__(self, node) @export class ArchitectureSymbol(VHDLModel_ArchitectureSymbol, DOMMixin): @InheritDocString(VHDLModel_ArchitectureSymbol) - def __init__(self, node: Iir, architectureName: SimpleName): - super().__init__(architectureName) + def __init__(self, node: Iir, identifier: str, prefix: EntitySymbol): + super().__init__(identifier, prefix) DOMMixin.__init__(self, node) @export class PackageSymbol(VHDLModel_PackageSymbol, DOMMixin): @InheritDocString(VHDLModel_PackageSymbol) - def __init__(self, node: Iir, packageName: SimpleName): - super().__init__(packageName) + def __init__(self, node: Iir, identifier: str): + super().__init__(identifier) DOMMixin.__init__(self, node) diff --git a/pyGHDL/dom/formatting/prettyprint.py b/pyGHDL/dom/formatting/prettyprint.py index 7c99e1d87..29751b507 100644 --- a/pyGHDL/dom/formatting/prettyprint.py +++ b/pyGHDL/dom/formatting/prettyprint.py @@ -236,7 +236,7 @@ class PrettyPrint: f"{prefix} Position: {architecture.Position.Line}:{architecture.Position.Column}\n" f"{prefix} Documentation: {documentationFirstLine}" ) - buffer.append(f"{prefix} Entity: {architecture.Entity.SymbolName}") + buffer.append(f"{prefix} Entity: {architecture.Entity.Identifier}") buffer.append(f"{prefix} Declared:") for item in architecture.DeclaredItems: for line in self.formatDeclaredItems(item, level + 2): |