Skip to content

Commit 186902a

Browse files
committed
Passthrough documentation in initializers.
1 parent 791e497 commit 186902a

File tree

1 file changed

+48
-46
lines changed

1 file changed

+48
-46
lines changed

pyVHDLModel/SyntaxModel.py

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,17 +1621,17 @@ class BaseConstant(Obj):
16211621

16221622
@export
16231623
class Constant(BaseConstant, WithDefaultExpressionMixin):
1624-
def __init__(self, identifiers: Iterable[str], subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None):
1625-
super().__init__(identifiers, subtype)
1624+
def __init__(self, identifiers: Iterable[str], subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None, documentation: str = None):
1625+
super().__init__(identifiers, subtype, documentation)
16261626
WithDefaultExpressionMixin.__init__(self, defaultExpression)
16271627

16281628

16291629
@export
16301630
class DeferredConstant(BaseConstant):
16311631
_constantReference: Constant
16321632

1633-
def __init__(self, identifiers: Iterable[str], subtype: SubtypeOrSymbol):
1634-
super().__init__(identifiers, subtype)
1633+
def __init__(self, identifiers: Iterable[str], subtype: SubtypeOrSymbol, documentation: str = None):
1634+
super().__init__(identifiers, subtype, documentation)
16351635

16361636
@property
16371637
def ConstantReference(self) -> Constant:
@@ -1640,8 +1640,8 @@ def ConstantReference(self) -> Constant:
16401640

16411641
@export
16421642
class Variable(Obj, WithDefaultExpressionMixin):
1643-
def __init__(self, identifiers: Iterable[str], subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None):
1644-
super().__init__(identifiers, subtype)
1643+
def __init__(self, identifiers: Iterable[str], subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None, documentation: str = None):
1644+
super().__init__(identifiers, subtype, documentation)
16451645
WithDefaultExpressionMixin.__init__(self, defaultExpression)
16461646

16471647

@@ -1652,8 +1652,8 @@ class SharedVariable(Obj):
16521652

16531653
@export
16541654
class Signal(Obj, WithDefaultExpressionMixin):
1655-
def __init__(self, identifiers: Iterable[str], subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None):
1656-
super(Signal, self).__init__(identifiers, subtype)
1655+
def __init__(self, identifiers: Iterable[str], subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None, documentation: str = None):
1656+
super().__init__(identifiers, subtype, documentation)
16571657
WithDefaultExpressionMixin.__init__(self, defaultExpression)
16581658

16591659

@@ -1710,8 +1710,8 @@ class Procedure(SubProgramm):
17101710
class Function(SubProgramm):
17111711
_returnType: Subtype
17121712

1713-
def __init__(self, identifier: str, isPure: bool = True):
1714-
super().__init__(identifier)
1713+
def __init__(self, identifier: str, isPure: bool = True, documentation: str = None):
1714+
super().__init__(identifier, documentation)
17151715
self._isPure = isPure
17161716

17171717
@property
@@ -1839,16 +1839,16 @@ class ParameterInterfaceItem(InterfaceItem):
18391839

18401840
@export
18411841
class GenericConstantInterfaceItem(Constant, GenericInterfaceItem, InterfaceItemWithMode):
1842-
def __init__(self, identifiers: Iterable[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None):
1843-
super().__init__(identifiers, subtype, defaultExpression)
1842+
def __init__(self, identifiers: Iterable[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None, documentation: str = None):
1843+
super().__init__(identifiers, subtype, defaultExpression, documentation)
18441844
GenericInterfaceItem.__init__(self)
18451845
InterfaceItemWithMode.__init__(self, mode)
18461846

18471847

18481848
@export
18491849
class GenericTypeInterfaceItem(Type, GenericInterfaceItem):
1850-
def __init__(self, identifier: str):
1851-
super().__init__(identifier)
1850+
def __init__(self, identifier: str, documentation: str):
1851+
super().__init__(identifier, documentation)
18521852
GenericInterfaceItem.__init__(self)
18531853

18541854

@@ -1859,60 +1859,60 @@ class GenericSubprogramInterfaceItem(GenericInterfaceItem):
18591859

18601860
@export
18611861
class GenericProcedureInterfaceItem(Procedure, GenericInterfaceItem):
1862-
def __init__(self, identifier: str):
1863-
super().__init__(identifier)
1862+
def __init__(self, identifier: str, documentation: str):
1863+
super().__init__(identifier, documentation)
18641864
GenericInterfaceItem.__init__(self)
18651865

18661866

18671867
@export
18681868
class GenericFunctionInterfaceItem(Function, GenericInterfaceItem):
1869-
def __init__(self, identifier: str):
1870-
super().__init__(identifier)
1869+
def __init__(self, identifier: str, documentation: str):
1870+
super().__init__(identifier, documentation)
18711871
GenericInterfaceItem.__init__(self)
18721872

18731873

18741874
@export
18751875
class GenericPackageInterfaceItem(GenericInterfaceItem):
1876-
def __init__(self, identifier: str):
1877-
# super().__init__(identifier)
1876+
def __init__(self, identifier: str, documentation: str):
1877+
# super().__init__(identifier, documentation)
18781878
GenericInterfaceItem.__init__(self)
18791879

18801880

18811881
@export
18821882
class PortSignalInterfaceItem(Signal, PortInterfaceItem):
1883-
def __init__(self, identifiers: Iterable[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None):
1884-
super().__init__(identifiers, subtype, defaultExpression)
1883+
def __init__(self, identifiers: Iterable[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None, documentation: str = None):
1884+
super().__init__(identifiers, subtype, defaultExpression, documentation)
18851885
PortInterfaceItem.__init__(self, mode)
18861886

18871887

18881888
@export
18891889
class ParameterConstantInterfaceItem(Constant, ParameterInterfaceItem, InterfaceItemWithMode):
1890-
def __init__(self, identifiers: Iterable[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None):
1891-
super().__init__(identifiers, subtype, defaultExpression)
1890+
def __init__(self, identifiers: Iterable[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None, documentation: str = None):
1891+
super().__init__(identifiers, subtype, defaultExpression, documentation)
18921892
ParameterInterfaceItem.__init__(self)
18931893
InterfaceItemWithMode.__init__(self, mode)
18941894

18951895

18961896
@export
18971897
class ParameterVariableInterfaceItem(Variable, ParameterInterfaceItem, InterfaceItemWithMode):
1898-
def __init__(self, identifiers: Iterable[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None):
1899-
super().__init__(identifiers, subtype, defaultExpression)
1898+
def __init__(self, identifiers: Iterable[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None, documentation: str = None):
1899+
super().__init__(identifiers, subtype, defaultExpression, documentation)
19001900
ParameterInterfaceItem.__init__(self)
19011901
InterfaceItemWithMode.__init__(self, mode)
19021902

19031903

19041904
@export
19051905
class ParameterSignalInterfaceItem(Signal, ParameterInterfaceItem, InterfaceItemWithMode):
1906-
def __init__(self, identifiers: Iterable[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None):
1907-
super().__init__(identifiers, subtype, defaultExpression)
1906+
def __init__(self, identifiers: Iterable[str], mode: Mode, subtype: SubtypeOrSymbol, defaultExpression: ExpressionUnion = None, documentation: str = None):
1907+
super().__init__(identifiers, subtype, defaultExpression, documentation)
19081908
ParameterInterfaceItem.__init__(self)
19091909
InterfaceItemWithMode.__init__(self, mode)
19101910

19111911

19121912
@export
19131913
class ParameterFileInterfaceItem(File, ParameterInterfaceItem):
1914-
def __init__(self, identifiers: Iterable[str], subtype: SubtypeOrSymbol):
1915-
super().__init__(identifiers, subtype)
1914+
def __init__(self, identifiers: Iterable[str], subtype: SubtypeOrSymbol, documentation: str = None):
1915+
super().__init__(identifiers, subtype, documentation)
19161916
ParameterInterfaceItem.__init__(self)
19171917

19181918

@@ -1950,8 +1950,8 @@ class Context(PrimaryUnit):
19501950
_libraryReferences: List[LibraryClause]
19511951
_packageReferences: List[UseClause]
19521952

1953-
def __init__(self, identifier: str, libraryReferences: Iterable[LibraryClause] = None, packageReferences: Iterable[UseClause] = None):
1954-
super().__init__(identifier)
1953+
def __init__(self, identifier: str, libraryReferences: Iterable[LibraryClause] = None, packageReferences: Iterable[UseClause] = None, documentation: str = None):
1954+
super().__init__(identifier, documentation)
19551955

19561956
self._libraryReferences = [] if libraryReferences is None else [l for l in libraryReferences]
19571957
self._packageReferences = [] if packageReferences is None else [p for p in packageReferences]
@@ -1980,9 +1980,10 @@ def __init__(
19801980
genericItems: Iterable[GenericInterfaceItem] = None,
19811981
portItems: Iterable[PortInterfaceItem] = None,
19821982
declaredItems: Iterable = None,
1983-
statements: Iterable['ConcurrentStatement'] = None
1983+
statements: Iterable['ConcurrentStatement'] = None,
1984+
documentation: str = None
19841985
):
1985-
super().__init__(identifier)
1986+
super().__init__(identifier, documentation)
19861987
MixinDesignUnitWithContext.__init__(self, contextItems)
19871988

19881989
self._genericItems = [] if genericItems is None else [g for g in genericItems]
@@ -2019,8 +2020,8 @@ class Architecture(SecondaryUnit, MixinDesignUnitWithContext):
20192020
_declaredItems: List # FIXME: define list prefix type e.g. via Union
20202021
_statements: List['ConcurrentStatement']
20212022

2022-
def __init__(self, identifier: str, entity: Name, contextItems: Iterable[Context] = None, declaredItems: Iterable = None, statements: Iterable['ConcurrentStatement'] = None):
2023-
super().__init__(identifier)
2023+
def __init__(self, identifier: str, entity: Name, contextItems: Iterable[Context] = None, declaredItems: Iterable = None, statements: Iterable['ConcurrentStatement'] = None, documentation: str = None):
2024+
super().__init__(identifier, documentation)
20242025
MixinDesignUnitWithContext.__init__(self, contextItems)
20252026

20262027
self._entity = EntitySymbol(entity)
@@ -2048,13 +2049,14 @@ def Statements(self) -> List['ConcurrentStatement']:
20482049

20492050

20502051
@export
2051-
class Component(ModelEntity, NamedEntity):
2052+
class Component(ModelEntity, NamedEntity, DocumentedEntity):
20522053
_genericItems: List[GenericInterfaceItem]
20532054
_portItems: List[PortInterfaceItem]
20542055

2055-
def __init__(self, identifier: str, genericItems: Iterable[GenericInterfaceItem] = None, portItems: Iterable[PortInterfaceItem] = None):
2056+
def __init__(self, identifier: str, genericItems: Iterable[GenericInterfaceItem] = None, portItems: Iterable[PortInterfaceItem] = None, documentation: str = None):
20562057
super().__init__()
20572058
NamedEntity.__init__(self, identifier)
2059+
DocumentedEntity.__init__(self, documentation)
20582060

20592061
self._genericItems = [] if genericItems is None else [g for g in genericItems]
20602062
self._portItems = [] if portItems is None else [p for p in portItems]
@@ -2070,8 +2072,8 @@ def PortItems(self) -> List[PortInterfaceItem]:
20702072

20712073
@export
20722074
class Configuration(PrimaryUnit, MixinDesignUnitWithContext):
2073-
def __init__(self, identifier: str, contextItems: Iterable[Context] = None):
2074-
super().__init__(identifier)
2075+
def __init__(self, identifier: str, contextItems: Iterable[Context] = None, documentation: str = None):
2076+
super().__init__(identifier, documentation)
20752077
MixinDesignUnitWithContext.__init__(self, contextItems)
20762078

20772079

@@ -2145,8 +2147,8 @@ class Package(PrimaryUnit, MixinDesignUnitWithContext):
21452147
_genericItems: List[GenericInterfaceItem]
21462148
_declaredItems: List
21472149

2148-
def __init__(self, identifier: str, contextItems: Iterable[Context] = None, genericItems: Iterable[GenericInterfaceItem] = None, declaredItems: Iterable = None):
2149-
super().__init__(identifier)
2150+
def __init__(self, identifier: str, contextItems: Iterable[Context] = None, genericItems: Iterable[GenericInterfaceItem] = None, declaredItems: Iterable = None, documentation: str = None):
2151+
super().__init__(identifier, documentation)
21502152
MixinDesignUnitWithContext.__init__(self, contextItems)
21512153

21522154
self._genericItems = [] if genericItems is None else [g for g in genericItems]
@@ -2166,8 +2168,8 @@ class PackageBody(SecondaryUnit, MixinDesignUnitWithContext):
21662168
_package: Package
21672169
_declaredItems: List
21682170

2169-
def __init__(self, identifier: str, contextItems: Iterable[Context] = None, declaredItems: Iterable = None):
2170-
super().__init__(identifier)
2171+
def __init__(self, identifier: str, contextItems: Iterable[Context] = None, declaredItems: Iterable = None, documentation: str = None):
2172+
super().__init__(identifier, documentation)
21712173
MixinDesignUnitWithContext.__init__(self, contextItems)
21722174

21732175
self._declaredItems = [] if declaredItems is None else [i for i in declaredItems]
@@ -2186,8 +2188,8 @@ class PackageInstantiation(PrimaryUnit, GenericEntityInstantiation):
21862188
_packageReference: Package
21872189
_genericAssociations: List[GenericAssociationItem]
21882190

2189-
def __init__(self, identifier: str, uninstantiatedPackage: PackageOrSymbol):
2190-
super().__init__(identifier)
2191+
def __init__(self, identifier: str, uninstantiatedPackage: PackageOrSymbol, documentation: str = None):
2192+
super().__init__(identifier, documentation)
21912193
GenericEntityInstantiation.__init__(self)
21922194

21932195
self._packageReference = uninstantiatedPackage

0 commit comments

Comments
 (0)