diff options
Diffstat (limited to 'build-aux/measurestack/analyze.py')
-rw-r--r-- | build-aux/measurestack/analyze.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/build-aux/measurestack/analyze.py b/build-aux/measurestack/analyze.py index b7b8b08..5b29841 100644 --- a/build-aux/measurestack/analyze.py +++ b/build-aux/measurestack/analyze.py @@ -174,7 +174,12 @@ class _Graph: graph: dict[QName, Node] qualified: dict[BaseName, QName] - def resolve_funcname(self, funcname: QName) -> QName | None: + _resolve_cache: dict[QName, QName | None] + + def __init__(self) -> None: + self._resolve_cache = {} + + def _resolve_funcname(self, funcname: QName) -> QName | None: s = str(funcname) is_qualified = ":" in s @@ -198,6 +203,11 @@ class _Graph: return None + def resolve_funcname(self, funcname: QName) -> QName | None: + if funcname not in self._resolve_cache: + self._resolve_cache[funcname] = self._resolve_funcname(funcname) + return self._resolve_cache[funcname] + def _make_graph( ci_fnames: typing.Collection[str], |