aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL/dom/_Translate.py
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@plc2.de>2021-06-23 10:52:13 +0200
committerPatrick Lehmann <Patrick.Lehmann@plc2.de>2021-06-23 10:52:13 +0200
commit95d5cb9329ee335a64e444ed0fd93bb0950edc5a (patch)
treefa886ee3df41077ee25d393d81628964acfe6a02 /pyGHDL/dom/_Translate.py
parentd4e3bf7941e6826c0175f4768c31155bd5d98b0e (diff)
downloadghdl-95d5cb9329ee335a64e444ed0fd93bb0950edc5a.tar.gz
ghdl-95d5cb9329ee335a64e444ed0fd93bb0950edc5a.tar.bz2
ghdl-95d5cb9329ee335a64e444ed0fd93bb0950edc5a.zip
Removed duplicate function.
Diffstat (limited to 'pyGHDL/dom/_Translate.py')
-rw-r--r--pyGHDL/dom/_Translate.py55
1 files changed, 9 insertions, 46 deletions
diff --git a/pyGHDL/dom/_Translate.py b/pyGHDL/dom/_Translate.py
index 8627fd5cb..beb13a11c 100644
--- a/pyGHDL/dom/_Translate.py
+++ b/pyGHDL/dom/_Translate.py
@@ -117,51 +117,6 @@ __all__ = []
@export
-def GetSubtypeIndicationFromNode(
- node: Iir, entity: str, name: str, do=True
-) -> SubTypeOrSymbol:
- if do:
- subTypeIndication = nodes.Get_Subtype_Indication(node)
- else:
- subTypeIndication = node
- if subTypeIndication is nodes.Null_Iir:
- return None
- subTypeKind = GetIirKindOfNode(subTypeIndication)
-
- if subTypeKind == nodes.Iir_Kind.Simple_Name:
- subTypeName = GetNameOfNode(subTypeIndication)
-
- subType = SimpleSubTypeSymbol(subTypeName)
- elif subTypeKind == nodes.Iir_Kind.Array_Subtype_Definition:
- typeMark = nodes.Get_Subtype_Type_Mark(subTypeIndication)
- typeMarkName = GetNameOfNode(typeMark)
-
- constraints = GetArrayConstraintsFromSubtypeIndication(subTypeIndication)
- subType = ConstrainedSubTypeSymbol(typeMarkName, constraints)
- elif subTypeKind == nodes.Iir_Kind.Subtype_Definition:
- raise DOMException(
- "Unknown handling of subtype kind '{kind}' of subtype indication '{indication}' while parsing {entity} '{name}'.".format(
- kind=subTypeKind, indication=subTypeIndication, entity=entity, name=name
- )
- )
- else:
- position = GetPositionOfNode(node)
- raise DOMException(
- "Unknown subtype kind '{kind}' of subtype indication '{indication}' while parsing {entity} '{name}' at {file}:{line}:{column}.".format(
- kind=subTypeKind,
- indication=subTypeIndication,
- entity=entity,
- name=name,
- file=position.Filename,
- line=position.Line,
- column=position.Column,
- )
- )
-
- return subType
-
-
-@export
def GetArrayConstraintsFromSubtypeIndication(
subTypeIndication: Iir,
) -> List[Constraint]:
@@ -229,7 +184,15 @@ def GetTypeFromNode(node: Iir) -> BaseType:
@export
-def GetSubTypeIndicationFromNode(
+def GetSubTypeIndicationFromNode(node: Iir, entity: str, name: str) -> SubTypeOrSymbol:
+ subTypeIndicationNode = nodes.Get_Subtype_Indication(node)
+ # if subTypeIndicationNode is nodes.Null_Iir:
+ # return None
+ return GetSubTypeIndicationFromIndicationNode(subTypeIndicationNode, entity, name)
+
+
+@export
+def GetSubTypeIndicationFromIndicationNode(
subTypeIndicationNode: Iir, entity: str, name: str
) -> SubTypeOrSymbol:
kind = GetIirKindOfNode(subTypeIndicationNode)