[gobject-introspection] sourcescanner: Make sure to mark constants as set



commit 1c57d575d195428a2cbaa4137095a3bffbd4c88f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Feb 18 16:28:36 2013 -0500

    sourcescanner: Make sure to mark constants as set
    
    This fixes complex constants.

 giscanner/sourcescanner.c              |   10 +++++++---
 tests/scanner/Regress-1.0-expected.gir |   15 +++++++++++++++
 2 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/giscanner/sourcescanner.c b/giscanner/sourcescanner.c
index c14c344..7ee0536 100644
--- a/giscanner/sourcescanner.c
+++ b/giscanner/sourcescanner.c
@@ -54,12 +54,16 @@ gi_source_symbol_copy (GISourceSymbol * symbol)
 
   if (symbol->base_type)
     new_symbol->base_type = gi_source_type_copy (symbol->base_type);
-  if (symbol->const_int_set)
+
+  if (symbol->const_int_set) {
     new_symbol->const_int = symbol->const_int;
-  else if (symbol->const_double_set)
+    new_symbol->const_int_set = TRUE;
+  } else if (symbol->const_double_set) {
     new_symbol->const_double = symbol->const_double;
-  else if (symbol->const_string != NULL)
+    new_symbol->const_double_set = TRUE;
+  } else if (symbol->const_string != NULL) {
     new_symbol->const_string = g_strdup (symbol->const_string);
+  }
 
   return new_symbol;
 }
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 22c4b0d..b238631 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -1908,6 +1908,16 @@ exposed to language bindings.</doc>
         </parameter>
       </parameters>
     </callback>
+    <constant name="GUINT64_CONSTANT"
+              value="18446744073709551615"
+              c:type="REGRESS_GUINT64_CONSTANT">
+      <type name="guint64" c:type="guint64"/>
+    </constant>
+    <constant name="GUINT64_CONSTANTA"
+              value="18446744073709551615"
+              c:type="REGRESS_GUINT64_CONSTANTA">
+      <type name="TestTypeGUInt64" c:type="RegressTestTypeGUInt64"/>
+    </constant>
     <constant name="G_GINT64_CONSTANT"
               value="1000"
               c:type="REGRESS_G_GINT64_CONSTANT">
@@ -1953,6 +1963,11 @@ exposed to language bindings.</doc>
               c:type="REGRESS_Mixed_Case_Constant">
       <type name="gint" c:type="gint"/>
     </constant>
+    <constant name="NEGATIVE_INT_CONSTANT"
+              value="-42"
+              c:type="REGRESS_NEGATIVE_INT_CONSTANT">
+      <type name="gint" c:type="gint"/>
+    </constant>
     <constant name="STRING_CONSTANT"
               value="Some String"
               c:type="REGRESS_STRING_CONSTANT">


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