[gobject-introspection] giscanner: make _pass_fixup_hidden_fields() more readable



commit e40d509f8247164ff8f893f516c6a7b37ce0a30f
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date:   Fri Feb 15 07:18:33 2013 +0100

    giscanner: make _pass_fixup_hidden_fields() more readable
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697621

 giscanner/maintransformer.py |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 8cfb80f..fb19986 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -108,16 +108,13 @@ class MainTransformer(object):
     def _pass_fixup_hidden_fields(self, node, chain):
         """Hide all callbacks starting with _; the typical
 usage is void (*_gtk_reserved1)(void);"""
-        if not isinstance(node, (ast.Class, ast.Interface,
-                                 ast.Record, ast.Union)):
-            return True
-        for field in node.fields:
-            if field is None:
-                continue
-            if (field.name.startswith('_')
+        if isinstance(node, (ast.Class, ast.Interface, ast.Record, ast.Union)):
+            for field in node.fields:
+                if (field
+                and field.name.startswith('_')
                 and field.anonymous_node is not None
                 and isinstance(field.anonymous_node, ast.Callback)):
-                field.introspectable = False
+                    field.introspectable = False
         return True
 
     def _get_validate_parameter_name(self, parent, param_name, origin):


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