[gobject-introspection] scanner: fix pairing of error quarks with registered enums



commit 981f0111c39725cf9b25c50d5b130b14f47dd8dd
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Jun 16 14:59:32 2012 +0200

    scanner: fix pairing of error quarks with registered enums
    
    _uscore_type_names maps from the c_symbol_prefix, which has the
    global ns prefix removed, so we need to split the function symbol
    before the lookup. Previously it worked because it used the heuristics
    for unregistered enums (and failed for GDBusError, which has two
    uppercase letters in succession)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=669350

 giscanner/maintransformer.py |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index bb10c99..850d242 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -917,15 +917,17 @@ the ones that failed to resolve removed."""
         for node in self._namespace.itervalues():
             if not isinstance(node, ast.ErrorQuarkFunction):
                 continue
-            short = node.symbol[:-len('_quark')]
-            if short == "g_io_error":
+            full = node.symbol[:-len('_quark')]
+            ns, short = self._transformer.split_csymbol(node.symbol)
+            short = short[:-len('_quark')]
+            if full == "g_io_error":
                 # Special case; GIOError was already taken forcing GIOErrorEnum
                 assert self._namespace.name == 'Gio'
                 enum = self._namespace.get('IOErrorEnum')
             else:
                 enum = self._uscore_type_names.get(short)
                 if enum is None:
-                    enum = uscore_enums.get(short)
+                    enum = uscore_enums.get(full)
             if enum is not None:
                 enum.error_domain = node.error_domain
             else:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]