diff options
author | c-thaler <bummberumm@googlemail.com> | 2023-04-03 23:52:29 +0200 |
---|---|---|
committer | tgingold <tgingold@users.noreply.github.com> | 2023-04-04 19:18:18 +0200 |
commit | 255f5de820ada16653d5a76fc5a85aa5c8008c6f (patch) | |
tree | 5dc2c52c55a45665f540afd3c027f4fa271b7a5c /pyGHDL/dom | |
parent | 76690d00c3129325c6c8b6d17171b74a7fd583a2 (diff) | |
download | ghdl-255f5de820ada16653d5a76fc5a85aa5c8008c6f.tar.gz ghdl-255f5de820ada16653d5a76fc5a85aa5c8008c6f.tar.bz2 ghdl-255f5de820ada16653d5a76fc5a85aa5c8008c6f.zip |
pyGHDL: fix range handling in subtype indication
According to §3.1, range can be a range expression or an attribute name.
This must be respected when accessing the fields of the node.
Diffstat (limited to 'pyGHDL/dom')
-rw-r--r-- | pyGHDL/dom/_Translate.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pyGHDL/dom/_Translate.py b/pyGHDL/dom/_Translate.py index 146c3443a..54c52614c 100644 --- a/pyGHDL/dom/_Translate.py +++ b/pyGHDL/dom/_Translate.py @@ -334,7 +334,13 @@ def GetScalarConstrainedSubtypeFromNode( typeMarkName = GetNameOfNode(typeMark) simpleTypeMark = SimpleName(typeMark, typeMarkName) rangeConstraint = nodes.Get_Range_Constraint(subtypeIndicationNode) - r = GetRangeFromNode(rangeConstraint) + + r = None + # Check if RangeExpression. Might also be an AttributeName (see §3.1) + if GetIirKindOfNode(rangeConstraint) == nodes.Iir_Kind.Range_Expression: + r = GetRangeFromNode(rangeConstraint) + #todo: Get actual range from AttributeName node? + return ConstrainedScalarSubtypeSymbol(subtypeIndicationNode, str(simpleTypeMark), r) # XXX: hacked |