From 20225660889132452360ff6e8403fbc88d60e677 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 14 Feb 2018 18:29:28 +0100 Subject: python binding: add leftest_location. --- src/vhdl/python/libghdl/thinutils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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: -- cgit v1.2.3