[gi-docgen/generic-id-ref: 2/4] gir: Find symbols inside dependencies
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gi-docgen/generic-id-ref: 2/4] gir: Find symbols inside dependencies
- Date: Sun, 22 Aug 2021 17:11:30 +0000 (UTC)
commit c693976d7bd74bcec66abc5dd0e8eedbdfadabea
Author: Emmanuele Bassi <ebassi gnome org>
Date: Sun Aug 22 18:06:15 2021 +0100
gir: Find symbols inside dependencies
If a C symbol is not found in the current namespace, traverse all the
dependencies to find it. If we do find it, return the namespace object
that contains the symbol.
gidocgen/gir/ast.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/gidocgen/gir/ast.py b/gidocgen/gir/ast.py
index bd2e6a2..e8fe7b0 100644
--- a/gidocgen/gir/ast.py
+++ b/gidocgen/gir/ast.py
@@ -1170,3 +1170,15 @@ class Repository:
if t.resolved:
return t
return types[0]
+
+ def find_symbol(self, name: str) -> T.Optional[T.Tuple[Namespace, Type]]:
+ log.debug(f"Looking for symbol {name} in current namespace {self.namespace.name}")
+ res = self.namespace.find_symbol(name)
+ if res is not None:
+ return (self.namespace, res)
+ for repo in self.includes.values():
+ log.debug(f"Looking for symbol {name} in namespace {repo.namespace.name}")
+ res = repo.namespace.find_symbol(name)
+ if res is not None:
+ return (repo.namespace, res)
+ return None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]