[Vala] [PATCH] Fixing some missing returns and improving boxed type handling in Vala.Struct
- From: Mathias Hasselmann <mathias hasselmann gmx de>
- To: vala paldo org
- Subject: [Vala] [PATCH] Fixing some missing returns and improving boxed type handling in Vala.Struct
- Date: Mon, 26 Mar 2007 22:28:11 +0200
---
trunk/vala/ChangeLog | 5 ++++
trunk/vala/vala/valastruct.vala | 46 ++++++++++++++++++++++++--------------
2 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/trunk/vala/ChangeLog b/trunk/vala/ChangeLog
index 8c42062..c5835a5 100644
--- a/trunk/vala/ChangeLog
+++ b/trunk/vala/ChangeLog
@@ -1,5 +1,10 @@
2007-03-26 Mathias Hasselmann <mathias hasselmann gmx de>
+ * vala/valastruct.vala: fixing some missing returns, further improving
+ boxed type handling
+
+2007-03-26 Mathias Hasselmann <mathias hasselmann gmx de>
+
* vala/valainterfacewriter.vala, vala/valastruct.vala: improve support
for boxed types
* vala/valainterfacewriter.vala: support static classes like PangoCairo
diff --git a/trunk/vala/vala/valastruct.vala b/trunk/vala/vala/valastruct.vala
index 08e5dd5..b5121cc 100644
--- a/trunk/vala/vala/valastruct.vala
+++ b/trunk/vala/vala/valastruct.vala
@@ -35,8 +35,10 @@ public class Vala.Struct : DataType {
private string cname;
private string const_cname;
- private string dup_function;
- private string free_function;
+ private string dup_function_name;
+ private string free_function_name;
+ private Method dup_function;
+ private Method free_function;
private Method ref_function;
private Method unref_function;
private string type_id;
@@ -119,11 +121,11 @@ public class Vala.Struct : DataType {
var name = m.name;
if (null != name) {
- if ("ref" == name) {
-stderr.printf(
- "struct %s, method %s, symbol: %s\n",
- this.name, m.name, null != m.symbol ? m.symbol.name : "(none)");
-assert(null != m.symbol);
+ if ("dup" == name || "copy" == name) {
+ dup_function = m;
+ } else if ("free" == name) {
+ free_function = m;
+ } else if ("ref" == name) {
ref_function = m;
} else if ("unref" == name) {
unref_function = m;
@@ -349,47 +351,55 @@ assert(null != m.symbol);
}
public override string get_dup_function () {
- if (dup_function != null) {
- return dup_function;
+ if (null != dup_function_name) {
+ return dup_function_name;
+ }
+ if (null != dup_function) {
+ return dup_function.get_cname();
}
if (is_boxed_type ()) {
return "g_boxed_copy";
}
Report.error (source_reference, "The type `%s` doesn't contain a copy function".printf
(symbol.get_full_name ()));
+ return null;
}
public void set_dup_function (string! name) {
- this.dup_function = name;
+ this.dup_function_name = name;
}
public override string get_free_function () {
- if (free_function != null) {
- return free_function;
+ if (null != free_function_name) {
+ return free_function_name;
+ }
+ if (null != free_function) {
+ return free_function.get_cname();
}
if (is_boxed_type ()) {
return "g_boxed_free";
}
Report.error (source_reference, "The type `%s` doesn't contain a free function".printf
(symbol.get_full_name ()));
+ return null;
}
private void set_free_function (string! name) {
- this.free_function = name;
+ this.free_function_name = name;
}
public override string get_ref_function () {
- if (null != ref_function)
+ if (null != ref_function) {
return ref_function.get_cname();
-
+ }
return null;
}
public override string get_unref_function () {
- if (null != unref_function)
+ if (null != unref_function) {
return unref_function.get_cname();
-
+ }
return null;
}
@@ -435,6 +445,7 @@ assert(null != m.symbol);
return "g_value_get_pointer";
} else {
Report.error (source_reference, "The value type `%s` doesn't declare a GValue
get function".printf (symbol.get_full_name ()));
+ return null;
}
} else {
return get_value_function;
@@ -447,6 +458,7 @@ assert(null != m.symbol);
return "g_value_set_pointer";
} else {
Report.error (source_reference, "The value type `%s` doesn't declare a GValue
set function".printf (symbol.get_full_name ()));
+ return null;
}
} else {
return set_value_function;
--
1.4.4.2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]