gobject-introspection r285 - in trunk: . giscanner tests/parser



Author: juergbi
Date: Thu Jun  5 11:45:46 2008
New Revision: 285
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=285&view=rev

Log:
2008-06-05  JÃrg Billeter  <j bitron ch>

	* giscanner/ast.py:
	* giscanner/girwriter.py:
	* giscanner/transformer.py:
	Use <type> element for field types
	* tests/parser/Foo-expected.gir:
	Update testcase


Modified:
   trunk/ChangeLog
   trunk/giscanner/ast.py
   trunk/giscanner/girwriter.py
   trunk/giscanner/transformer.py
   trunk/tests/parser/Foo-expected.gir

Modified: trunk/giscanner/ast.py
==============================================================================
--- trunk/giscanner/ast.py	(original)
+++ trunk/giscanner/ast.py	Thu Jun  5 11:45:46 2008
@@ -151,6 +151,16 @@
         self.symbol = symbol
 
 
+class Field(Node):
+    def __init__(self, name, typenode, symbol):
+        Node.__init__(self, name)
+        self.type = typenode
+        self.symbol = symbol
+
+    def __repr__(self):
+        return 'Field(%r, %r)' % (self.name, self.type)
+
+
 class Return(Node):
     def __init__(self, rtype):
         Node.__init__(self)

Modified: trunk/giscanner/girwriter.py
==============================================================================
--- trunk/giscanner/girwriter.py	(original)
+++ trunk/giscanner/girwriter.py	Thu Jun  5 11:45:46 2008
@@ -218,9 +218,9 @@
             self._write_callback(field)
             return
 
-        attrs = [('name', field.name),
-                 ('value', str(field.value))]
-        self.write_tag('field', attrs)
+        attrs = [('name', field.name)]
+        with self.tagcontext('field', attrs):
+            self._write_type(field.type)
 
     def _write_signal(self, signal):
         attrs = [('name', signal.name)]

Modified: trunk/giscanner/transformer.py
==============================================================================
--- trunk/giscanner/transformer.py	(original)
+++ trunk/giscanner/transformer.py	Thu Jun  5 11:45:46 2008
@@ -19,7 +19,8 @@
 #
 
 from giscanner.ast import (Callback, Enum, Function, Namespace, Member,
-                           Parameter, Return, Sequence, Struct, Type)
+                           Parameter, Return, Sequence, Struct, Field,
+                           Type)
 from giscanner.sourcescanner import (
     SourceSymbol, ctype_name, symbol_type_name, CTYPE_POINTER,
     CTYPE_BASIC_TYPE, CTYPE_UNION, CTYPE_ARRAY,
@@ -179,8 +180,8 @@
             symbol.base_type.base_type.type == CTYPE_FUNCTION):
             node = self._create_callback(symbol)
         else:
-            node = Member(symbol.ident, self._create_source_type(symbol),
-                          symbol.ident)
+            ftype = self._create_type(symbol.base_type)
+            node = Field(symbol.ident, ftype, symbol.ident)
         return node
     
     def _create_typedef(self, symbol):

Modified: trunk/tests/parser/Foo-expected.gir
==============================================================================
--- trunk/tests/parser/Foo-expected.gir	(original)
+++ trunk/tests/parser/Foo-expected.gir	Thu Jun  5 11:45:46 2008
@@ -298,15 +298,27 @@
       </parameters>
     </callback>
     <record name="FooStruct" c:type="FooStruct">
-      <field name="priv" value="FooStructPrivate*"/>
-      <field name="member" value="int"/>
+      <field name="priv">
+        <type name="FooStructPrivate*" c:type="FooStructPrivate*"/>
+      </field>
+      <field name="member">
+        <type name="int" c:type="int"/>
+      </field>
     </record>
     <record name="FooStructPrivate" c:type="FooStructPrivate"/>
     <record name="FooRectangle" c:type="FooRectangle">
-      <field name="x" value="gint"/>
-      <field name="y" value="gint"/>
-      <field name="width" value="gint"/>
-      <field name="height" value="gint"/>
+      <field name="x">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="y">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="width">
+        <type name="gint" c:type="gint"/>
+      </field>
+      <field name="height">
+        <type name="gint" c:type="gint"/>
+      </field>
     </record>
   </namespace>
 </repository>



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