summaryrefslogtreecommitdiff
path: root/giscanner/ast.py
diff options
context:
space:
mode:
authorLucas Rocha <lucasr@gnome.org>2008-10-11 18:33:43 +0000
committerLucas Almeida Rocha <lucasr@src.gnome.org>2008-10-11 18:33:43 +0000
commit0be08ed820506a63b5a9342d52d695f977934145 (patch)
tree2955cbd94fba25494a18deedbf176a88e41a84a4 /giscanner/ast.py
parentf1be097d3be66639374c160225f01cfd42275953 (diff)
downloadgobject-introspection-0be08ed820506a63b5a9342d52d695f977934145.tar.gz
Bug 554854: The --typelib-xml and --inject options should reuse giscanner
2008-10-11 Lucas Rocha <lucasr@gnome.org> Bug 554854: The --typelib-xml and --inject options should reuse giscanner parser/writer. * giscanner/ast.py: add constructor list to Struct and Union. Add new param in Return's contructor to define transfer. * giscanner/girparser.py: several additions to the parser in order to have parsing all nodes of the gir xml files. * tools/g-ir-scanner (typelib_xml_strip, inject): use gir parser and writer in --inject and --typelib-xml options. * giscanner/xmlwriter.py: ignore empty attributes instead of raising an error as this basically exposes a bug in GIRParser. This should be reverted as soon as the parser is fixed. svn path=/trunk/; revision=665
Diffstat (limited to 'giscanner/ast.py')
-rw-r--r--giscanner/ast.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 368f02e0..0c82623a 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -260,6 +260,7 @@ class Struct(Node):
def __init__(self, name, symbol):
Node.__init__(self, name)
self.fields = []
+ self.constructors = []
self.symbol = symbol
@@ -276,11 +277,11 @@ class Field(Node):
class Return(Node):
- def __init__(self, rtype):
+ def __init__(self, rtype, transfer=False):
Node.__init__(self)
self.type = rtype
self.transfer = isinstance(rtype, (List, Map, Array)) or \
- rtype.name in ('utf8', 'filename')
+ rtype.name in ('utf8', 'filename') or transfer
def __repr__(self):
return 'Return(%r)' % (self.type, )
@@ -369,6 +370,7 @@ class Union(Node):
def __init__(self, name, symbol):
Node.__init__(self, name)
self.fields = []
+ self.constructors = []
self.symbol = symbol
def __repr__(self):