[gobject-introspection] Revert "Implement "rename to" annotation for records"



commit 0e13b86146eaa2fd58fc5165b11eb4f8396108fa
Author: Colin Walters <walters verbum org>
Date:   Thu Aug 9 17:17:15 2012 -0400

    Revert "Implement "rename to" annotation for records"
    
    This reverts commit 764366f7e4ef5a765a24ffac8c60b811f38b9ad9.
    
    It can't work right now because to really use the structures, you need
    to register them as a boxed, and that means we also need to rename the
    boxed type.
    
    A future version of this patch will need to handle both the structure
    name and the GType name.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=675985

 giscanner/maintransformer.py           |   20 +++++---------------
 tests/scanner/Regress-1.0-expected.gir |   29 -----------------------------
 tests/scanner/regress.c                |   17 -----------------
 tests/scanner/regress.h                |   17 -----------------
 4 files changed, 5 insertions(+), 78 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index eb6b8b3..77a66d2 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -60,14 +60,14 @@ class MainTransformer(object):
         # Some initial namespace surgery
         self._namespace.walk(self._pass_fixup_hidden_fields)
 
-        # Read in annotations needed early
-        self._namespace.walk(self._pass_read_annotations_early)
-
         # We have a rough tree which should have most of of the types
         # we know about.  Let's attempt closure; walk over all of the
         # Type() types and see if they match up with something.
         self._namespace.walk(self._pass_type_resolution)
 
+        # Read in annotations needed early
+        self._namespace.walk(self._pass_read_annotations_early)
+
         # Determine some default values for transfer etc.
         # based on the current tree.
         self._namespace.walk(self._pass_callable_defaults)
@@ -139,16 +139,7 @@ usage is void (*_gtk_reserved1)(void);"""
 
         return param.argname
 
-    def _apply_annotation_rename_to_record(self, node, chain, block):
-        if not block:
-            return
-        rename_to = block.get_tag(TAG_RENAME_TO)
-        if not rename_to:
-            return
-
-        node.name = rename_to.value
-
-    def _apply_annotation_rename_to_function(self, node, chain, block):
+    def _apply_annotation_rename_to(self, node, chain, block):
         if not block:
             return
         rename_to = block.get_tag(TAG_RENAME_TO)
@@ -186,7 +177,6 @@ usage is void (*_gtk_reserved1)(void);"""
                 block = self._blocks.get(node.ctype)
             else:
                 block = self._blocks.get(node.c_name)
-            self._apply_annotation_rename_to_record(node, chain, block)
             self._apply_annotations_annotated(node, block)
         return True
 
@@ -838,7 +828,7 @@ usage is void (*_gtk_reserved1)(void);"""
     def _apply_annotations2_function(self, node, chain):
         block = self._blocks.get(node.symbol)
 
-        self._apply_annotation_rename_to_function(node, chain, block)
+        self._apply_annotation_rename_to(node, chain, block)
 
         # Handle virtual invokers
         parent = chain[-1] if chain else None
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 4d4dcd7..e954705 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -92,13 +92,6 @@ and/or use gtk-doc annotations.  -->
               c:type="REGRESS_Mixed_Case_Constant">
       <type name="gint" c:type="gint"/>
     </constant>
-    <record name="Object" c:type="RegressRenameToStruct">
-      <doc xml:whitespace="preserve">A type with the same name as the library prefix. With the following
-directive, should be available as Regress.Object</doc>
-      <field name="data" writable="1">
-        <type name="gpointer" c:type="gpointer"/>
-      </field>
-    </record>
     <constant name="STRING_CONSTANT"
               value="Some String"
               c:type="REGRESS_STRING_CONSTANT">
@@ -1788,28 +1781,6 @@ libgnome-keyring.</doc>
         </parameter>
       </parameters>
     </function>
-    <function name="rename_to_struct_new"
-              c:identifier="regress_rename_to_struct_new"
-              introspectable="0">
-      <return-value transfer-ownership="full">
-        <type name="Object" c:type="RegressRenameToStruct*"/>
-      </return-value>
-    </function>
-    <function name="rename_to_struct_set_data"
-              c:identifier="regress_rename_to_struct_set_data"
-              introspectable="0">
-      <return-value transfer-ownership="none">
-        <type name="none" c:type="void"/>
-      </return-value>
-      <parameters>
-        <parameter name="self" transfer-ownership="none">
-          <type name="Object" c:type="RegressRenameToStruct*"/>
-        </parameter>
-        <parameter name="data" transfer-ownership="none">
-          <type name="gpointer" c:type="gpointer"/>
-        </parameter>
-      </parameters>
-    </function>
     <function name="set_abort_on_error"
               c:identifier="regress_set_abort_on_error">
       <return-value transfer-ownership="none">
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index e6fa25f..910f01a 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -3813,20 +3813,3 @@ void
 regress_test_versioning (void)
 {
 }
-
-/**
- * regress_rename_to_struct_new:
- *
- * Returns: (transfer full):
- */
-RegressRenameToStruct *
-regress_rename_to_struct_new (void)
-{
-    return g_new0 (RegressRenameToStruct, 1);
-}
-
-void
-regress_rename_to_struct_set_data (RegressRenameToStruct *self, gpointer data)
-{
-    self->data = data;
-}
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index ace1832..d6bdacb 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -894,21 +894,4 @@ typedef struct {
   double dummy2;
 } RegressLikeGnomeKeyringPasswordSchema;
 
-
-
-/**
- * RegressRenameToStruct:
- * 
- * A type with the same name as the library prefix. With the following
- * directive, should be available as Regress.Object
- *
- * Rename to: Object
- **/
-typedef struct {
-    gpointer data;
-} RegressRenameToStruct;
-
-RegressRenameToStruct * regress_rename_to_struct_new (void);
-void regress_rename_to_struct_set_data (RegressRenameToStruct *self, gpointer data);
-
 #endif /* __GITESTTYPES_H__ */



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