summaryrefslogtreecommitdiff
path: root/giscanner/transformer.py
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2014-01-03 11:08:31 -0800
committerSimon Feltman <sfeltman@src.gnome.org>2014-01-04 13:48:27 -0800
commitdae7e628d5da911c5a427309c935f64747dfa516 (patch)
tree27cb71f7f2983d1d8c622d17de0ce6b76c4cafef /giscanner/transformer.py
parent9d8d159c28a482de6bdaa06f3805f65d3c55e958 (diff)
downloadgobject-introspection-dae7e628d5da911c5a427309c935f64747dfa516.tar.gz
scanner: Add simplified parsing for nested structs
Add _create_member_struct for the parsing of nested structs. This is precursory work to remove the member/anonymous flag from other struct/union creation code and allow simplification of those code paths. https://bugzilla.gnome.org/show_bug.cgi?id=581525
Diffstat (limited to 'giscanner/transformer.py')
-rw-r--r--giscanner/transformer.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 00128064..d2631b28 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -531,7 +531,7 @@ raise ValueError."""
and symbol.base_type.base_type.type == CTYPE_FUNCTION):
node = self._create_callback(symbol, member=True)
elif source_type.type == CTYPE_STRUCT and source_type.name is None:
- node = self._create_struct(symbol, anonymous=True)
+ node = self._create_member_struct(symbol)
elif source_type.type == CTYPE_UNION and source_type.name is None:
node = self._create_union(symbol, anonymous=True)
else:
@@ -844,6 +844,12 @@ raise ValueError."""
struct.add_symbol_reference(symbol)
return struct
+ def _create_member_struct(self, symbol):
+ struct = ast.Record(symbol.ident, symbol.ident)
+ self._parse_fields(symbol, struct)
+ struct.add_symbol_reference(symbol)
+ return struct
+
def _create_typedef_union(self, symbol):
try:
name = self.strip_identifier(symbol.ident)
@@ -904,9 +910,6 @@ raise ValueError."""
compound.add_symbol_reference(symbol)
return compound
- def _create_struct(self, symbol, anonymous=False):
- return self._create_compound(ast.Record, symbol, anonymous)
-
def _create_union(self, symbol, anonymous=False):
return self._create_compound(ast.Union, symbol, anonymous)