summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-02-18 16:28:36 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2013-02-18 16:30:56 -0500
commit1c57d575d195428a2cbaa4137095a3bffbd4c88f (patch)
tree2b6c470f3d2e3646f1affb4211e87824cae94b43
parent5aa1e8c8cb1d8dee3c214235634539ccd7eda8fe (diff)
downloadgobject-introspection-1c57d575d195428a2cbaa4137095a3bffbd4c88f.tar.gz
sourcescanner: Make sure to mark constants as set
This fixes complex constants.
-rw-r--r--giscanner/sourcescanner.c10
-rw-r--r--tests/scanner/Regress-1.0-expected.gir15
2 files changed, 22 insertions, 3 deletions
diff --git a/giscanner/sourcescanner.c b/giscanner/sourcescanner.c
index c14c3449..7ee0536c 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 22c4b0db..b238631a 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">