gobject-introspection r652 - trunk/giscanner
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r652 - trunk/giscanner
- Date: Fri, 3 Oct 2008 17:18:15 +0000 (UTC)
Author: walters
Date: Fri Oct 3 17:18:15 2008
New Revision: 652
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=652&view=rev
Log:
Avoid resolving types as we create them, do it all at once at the end
Also resolve types for object fields
Modified:
trunk/giscanner/glibtransformer.py
trunk/giscanner/transformer.py
Modified: trunk/giscanner/glibtransformer.py
==============================================================================
--- trunk/giscanner/glibtransformer.py (original)
+++ trunk/giscanner/glibtransformer.py Fri Oct 3 17:18:15 2008
@@ -744,6 +744,8 @@
self._resolve_methods(node.methods)
self._resolve_properties(node.properties)
self._resolve_signals(node.signals)
+ for field in node.fields:
+ self._resolve_field(field)
def _resolve_glib_boxed(self, node):
self._resolve_constructors(node.constructors)
Modified: trunk/giscanner/transformer.py
==============================================================================
--- trunk/giscanner/transformer.py (original)
+++ trunk/giscanner/transformer.py Fri Oct 3 17:18:15 2008
@@ -310,10 +310,10 @@
"symbol %r of type %s" % (symbol.ident, ctype_name(ctype)))
return node
- def _parse_and_resolve_ctype(self, ctype):
+ def _parse_ctype(self, ctype):
canonical = type_name_from_ctype(ctype)
derefed = canonical.replace('*', '')
- return self.resolve_type_name(derefed, derefed)
+ return derefed
def _create_type(self, source_type, options=[]):
ctype = self._create_source_type(source_type)
@@ -325,7 +325,7 @@
raise SkipError
if ctype in self._list_ctypes:
if len(options) > 0:
- contained_type = self._parse_and_resolve_ctype(options[0])
+ contained_type = self._parse_ctype(options[0])
del options[0]
else:
contained_type = None
@@ -334,8 +334,8 @@
contained_type)
if ctype in self._list_ctypes:
if len(options) > 0:
- key_type = self._parse_and_resolve_ctype(options[0])
- value_type = self._parse_and_resolve_ctype(options[1])
+ key_type = self._parse_ctype(options[0])
+ value_type = self._parse_ctype(options[1])
del options[0:2]
else:
key_type = None
@@ -348,8 +348,8 @@
options.remove('array')
derefed = ctype[:-1] # strip the *
return Array(ctype,
- self._parse_and_resolve_ctype(derefed))
- resolved_type_name = self._parse_and_resolve_ctype(ctype)
+ self._parse_ctype(derefed))
+ resolved_type_name = self._parse_ctype(ctype)
return Type(resolved_type_name, ctype)
def _create_parameter(self, symbol, options):
@@ -523,13 +523,20 @@
return None
def resolve_param_type_full(self, ptype, names):
- if isinstance(ptype, Array):
- ptype.element_type = \
- self.resolve_param_type_full(ptype.element_type, names)
- elif isinstance(ptype, Node):
+ if isinstance(ptype, Node):
ptype.name = self.resolve_type_name_full(ptype.name,
self.ctype_of(ptype),
names)
+ if isinstance(ptype, (Array, List)):
+ if ptype.element_type is not None:
+ ptype.element_type = \
+ self.resolve_param_type_full(ptype.element_type, names)
+ if isinstance(ptype, Map):
+ if ptype.key_type is not None:
+ ptype.key_type = \
+ self.resolve_param_type_full(ptype.key_type, names)
+ ptype.value_type = \
+ self.resolve_param_type_full(ptype.value_type, names)
elif isinstance(ptype, basestring):
return self.resolve_type_name_full(ptype, None, names)
else:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]