[vala] Write has_type_id attribute for structs in VAPI files



commit a17037a256f832ecef67a7134e8d99bee138835a
Author: Jürg Billeter <j bitron ch>
Date:   Sun Jan 10 20:49:06 2010 +0100

    Write has_type_id attribute for structs in VAPI files
    
    Make sure we don't lose has_type_id if it's false.
    
    Based on patch by Marc-André Lureau, fixes bug 606580.

 vala/valacodewriter.vala |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index e6dd882..a23f05f 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -320,17 +320,19 @@ public class Vala.CodeWriter : CodeVisitor {
 			write_string ("cname = \"%s\", ".printf (st.get_cname ()));
 		}
 
-		if (!st.is_simple_type () && st.get_type_id () != "G_TYPE_POINTER") {
+		if (!st.has_type_id) {
+			write_string ("has_type_id = false");
+		} else if (!st.is_simple_type () && st.get_type_id () != "G_TYPE_POINTER") {
 			write_string ("type_id = \"%s\", ".printf (st.get_type_id ()));
 		}
 
-                if (!st.has_copy_function) {
-                        write_string ("has_copy_function = false, ");
-                }
+		if (!st.has_copy_function) {
+			write_string ("has_copy_function = false, ");
+		}
 
-                if (!st.has_destroy_function) {
-                        write_string ("has_destroy_function = false, ");
-                }
+		if (!st.has_destroy_function) {
+			write_string ("has_destroy_function = false, ");
+		}
 
 		write_string ("cheader_filename = \"%s\")]".printf (get_cheaders(st)));
 		write_newline ();
@@ -470,7 +472,7 @@ public class Vala.CodeWriter : CodeVisitor {
 		write_string ("[CCode (cprefix = \"%s\", ".printf (en.get_cprefix ()));
 
 		if (!en.has_type_id) {
-			write_string ("has_type_id = \"%d\", ".printf (en.has_type_id ? 1 : 0));
+			write_string ("has_type_id = false");
 		}
 
 		write_string ("cheader_filename = \"%s\")]".printf (get_cheaders(en)));



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