aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-02-14 18:29:28 +0100
committerTristan Gingold <tgingold@free.fr>2018-02-15 18:26:12 +0100
commit20225660889132452360ff6e8403fbc88d60e677 (patch)
treed6ddfc3c3a9a6c064453d360034302fa1161f8d7 /src
parent8669c8f94463850aa7cdcc2b8aa1e51c1a003bc8 (diff)
downloadghdl-20225660889132452360ff6e8403fbc88d60e677.tar.gz
ghdl-20225660889132452360ff6e8403fbc88d60e677.tar.bz2
ghdl-20225660889132452360ff6e8403fbc88d60e677.zip
python binding: add leftest_location.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/python/libghdl/thinutils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/vhdl/python/libghdl/thinutils.py b/src/vhdl/python/libghdl/thinutils.py
index be2957512..1e8ee417d 100644
--- a/src/vhdl/python/libghdl/thinutils.py
+++ b/src/vhdl/python/libghdl/thinutils.py
@@ -50,6 +50,17 @@ def attr_image(a):
return _attr_image[a]
+def leftest_location(n):
+ while True:
+ if n == Null_Iir:
+ return No_Location
+ k = iirs.Get_Kind(n)
+ if k == iirs.Iir_Kind.Array_Subtype_Definition:
+ n = iirs.Get_Subtype_Type_Mark(n)
+ else:
+ return iirs.Get_Location(n)
+
+
def fields_iter(n):
"""Iterate on fields of node n"""
if n == Null_Iir: