Avoid having functions/ctors duplicated in global scope
authorColin Walters <walters@src.gnome.org>
Fri, 29 Aug 2008 18:19:29 +0000 (18:19 +0000)
committerColin Walters <walters@src.gnome.org>
Fri, 29 Aug 2008 18:19:29 +0000 (18:19 +0000)
* giscanner/glibtransformer.py: Add some informative
logging messages in corner cases.  Be sure we use
the most recent node set instead of a cache
when generating result set.
* tests/: Remove duplicated bits in expected girs

svn path=/trunk/; revision=523

giscanner/glibtransformer.py
tests/scanner/drawable-expected.gir
tests/scanner/foo-expected.gir

index 0d67452af68ade591dc7acbfedebb2e54e6cc2ab..2a890e4a36277dcfed959501a59ace2b2e0d0b0a 100644 (file)
@@ -112,8 +112,9 @@ class GLibTransformer(object):
         # Create a new namespace with what we found
         namespace = Namespace(namespace.name)
         namespace.nodes = map(lambda x: x[1], self._names.aliases.itervalues())
-        for (ns, x) in nodes:
+        for (ns, x) in self._names.names.itervalues():
             namespace.nodes.append(x)
+        print "Scan complete."
         return namespace
 
     # Private
@@ -298,6 +299,8 @@ class GLibTransformer(object):
                 return None
             # Constructors don't return basic types
             if target_arg.type.name in type_names:
+                print "NOTE: Rejecting constructor returning basic: %r" \
+                    % (func.symbol, )
                 return None
             prefix = func.symbol[:new_idx]
 
@@ -321,11 +324,15 @@ class GLibTransformer(object):
                         break
         # Enums can't have ctors or methods
         if klass is None:
+            print "NOTE: No valid matching class for likely "+\
+                "method or constructor: %r" % (func.symbol, )
             return
 
         if not is_method:
             # Interfaces can't have constructors, punt to global scope
             if isinstance(klass, GLibInterface):
+                print "NOTE: Rejecting method or constructor for"+\
+                    " interface type: %r" % (func.symbol, )
                 return None
             # TODO - check that the return type is a subclass of the
             # class from the prefix
index 02b72ca7a548b1a88579b2351b0c1f23745addb5..2388970711e43de4ed265173d9f684259b4af997 100644 (file)
         <type name="GObject.Class" c:type="GObjectClass"/>
       </field>
     </record>
-    <function name="do_foo" c:identifier="test_drawable_do_foo">
-      <return-value>
-        <type name="none" c:type="void"/>
-      </return-value>
-      <parameters>
-        <parameter name="drawable">
-          <type name="TestDrawable" c:type="TestDrawable*"/>
-        </parameter>
-        <parameter name="x">
-          <type name="int" c:type="int"/>
-        </parameter>
-      </parameters>
-    </function>
     <record name="TestPixmapObjectClass" c:type="_TestPixmapObjectClass">
       <field name="parent_class">
         <type name="TestDrawableClass" c:type="TestDrawableClass"/>
index 3767775cde44b7f1c26d6faffac40f3d3796e2af..acd2492f400eed7d72e2caf12f2eb2c9fc5d79f0 100644 (file)
         <type name="int" c:type="gint"/>
       </return-value>
     </function>
-    <function name="new" c:identifier="foo_object_new">
-      <return-value>
-        <type name="Object" c:type="FooObject*"/>
-      </return-value>
-    </function>
-    <function name="external_type" c:identifier="foo_object_external_type">
-      <return-value>
-        <type name="utility.Object" c:type="UtilityObject*"/>
-      </return-value>
-      <parameters>
-        <parameter name="object">
-          <type name="Object" c:type="FooObject*"/>
-        </parameter>
-      </parameters>
-    </function>
-    <function name="various" c:identifier="foo_object_various">
-      <return-value>
-        <type name="none" c:type="void"/>
-      </return-value>
-      <parameters>
-        <parameter name="object">
-          <type name="Object" c:type="FooObject*"/>
-        </parameter>
-        <parameter name="data">
-          <type name="any" c:type="void*"/>
-        </parameter>
-        <parameter name="some_type">
-          <type name="GObject.Type" c:type="GType"/>
-        </parameter>
-      </parameters>
-    </function>
-    <function name="with_tdef" c:identifier="foo_object_with_tdef">
-      <return-value>
-        <type name="none" c:type="void"/>
-      </return-value>
-      <parameters>
-        <parameter name="object">
-          <type name="Object" c:type="FooObject*"/>
-        </parameter>
-        <parameter name="blah">
-          <type name="List" c:type="FooList*"/>
-        </parameter>
-      </parameters>
-    </function>
-    <function name="new" c:identifier="foo_subobject_new">
-      <return-value>
-        <type name="Subobject" c:type="FooSubobject*"/>
-      </return-value>
-    </function>
     <enumeration name="EnumType"
                  c:type="FooEnumType"
                  glib:type-name="FooEnumType"
         </parameters>
       </method>
     </glib:boxed>
-    <function name="new" c:identifier="foo_boxed_new">
-      <return-value>
-        <type name="Boxed" c:type="FooBoxed*"/>
-      </return-value>
-    </function>
-    <function name="method" c:identifier="foo_boxed_method">
-      <return-value>
-        <type name="none" c:type="void"/>
-      </return-value>
-      <parameters>
-        <parameter name="boxed">
-          <type name="Boxed" c:type="FooBoxed*"/>
-        </parameter>
-      </parameters>
-    </function>
     <callback name="Callback" c:type="FooCallback">
       <return-value>
         <type name="boolean" c:type="gboolean"/>