[vala] girparser: Threat non-boxed disguised records as compact classes
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] girparser: Threat non-boxed disguised records as compact classes
- Date: Sun, 29 May 2011 20:02:04 +0000 (UTC)
commit 507697e0902f21b02356c3237207b935663ef3a5
Author: Luca Bruno <lucabru src gnome org>
Date: Sun May 29 21:43:37 2011 +0200
girparser: Threat non-boxed disguised records as compact classes
Fixes bug 651408.
vala/valagirparser.vala | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 839c105..0140f6e 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1667,10 +1667,14 @@ public class Vala.GirParser : CodeVisitor {
parse_callback ();
} else if (reader.name == "record") {
if (reader.get_attribute ("glib:get-type") != null && !metadata.get_bool (ArgumentType.STRUCT)) {
- parse_boxed ("record");
+ parse_compact_class ("record", true);
} else {
if (!reader.get_attribute ("name").has_suffix ("Private")) {
- parse_record ();
+ if (reader.get_attribute ("disguised") == "1") {
+ parse_compact_class ("record", false);
+ } else {
+ parse_record ();
+ }
} else {
skip_element ();
}
@@ -1680,7 +1684,7 @@ public class Vala.GirParser : CodeVisitor {
} else if (reader.name == "interface") {
parse_interface ();
} else if (reader.name == "glib:boxed") {
- parse_boxed ("glib:boxed");
+ parse_compact_class ("glib:boxed", true);
} else if (reader.name == "union") {
parse_union ();
} else if (reader.name == "constant") {
@@ -2545,7 +2549,7 @@ public class Vala.GirParser : CodeVisitor {
parse_function ("glib:signal");
}
- void parse_boxed (string element_name) {
+ void parse_compact_class (string element_name, bool is_boxed) {
start_element (element_name);
string name = reader.get_attribute ("name");
if (name == null) {
@@ -2565,8 +2569,10 @@ public class Vala.GirParser : CodeVisitor {
if (typeid != null) {
cl.set_type_id ("%s ()".printf (typeid));
}
- cl.set_free_function ("g_boxed_free");
- cl.set_dup_function ("g_boxed_copy");
+ if (is_boxed) {
+ cl.set_free_function ("g_boxed_free");
+ cl.set_dup_function ("g_boxed_copy");
+ }
current.symbol = cl;
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]