summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2013-02-15 07:18:33 +0100
committerDieter Verfaillie <dieterv@optionexplicit.be>2013-04-09 23:16:54 +0200
commite40d509f8247164ff8f893f516c6a7b37ce0a30f (patch)
treeaaf10bca0e23c479aaf192d93fe1dd8b2d152e70
parente4b98d842ee34bf06e1afd22966ffe56885f546b (diff)
downloadgobject-introspection-e40d509f8247164ff8f893f516c6a7b37ce0a30f.tar.gz
giscanner: make _pass_fixup_hidden_fields() more readable
https://bugzilla.gnome.org/show_bug.cgi?id=697621
-rw-r--r--giscanner/maintransformer.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 8cfb80f8..fb199861 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):