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

[Vala] GIR output patch



Hi,

After a brief discussion with juergbi today on IRC (whilst trying to
get java-gobject-introspection running over libvala to work with
Valable), I've made the following patch to 0.4.0.

It fixes gobject/valagirwriter.vala to include the, now mandatory,
``transfer-ownership'' attribute in the appropriate places.

juergbi was right, however, since the current version of Vala isn't
using GObjects; the resulting .gir files still won't work with
g-ir-compile: the root object isn't GObject, so valagirwriter outputs
<record>s rather than <class>es - which then cause problems with
methods & properties.

This patch is, therefore, slightly academic.

Cheers,

Andrew

-- 
Andrew Flegg -- mailto:andrew bleb org  |  http://www.bleb.org/
maemo.org Community Council member
--- vala-0.4.0/gobject/valagirwriter.vala	2008-10-20 20:29:18.000000000 +0100
+++ vala-0.4.0-new/gobject/valagirwriter.vala	2008-11-02 20:31:18.000000000 +0000
@@ -323,22 +323,20 @@
 			write_indent ();
 			stream.printf ("<parameter name=\"%s\"", param.name);
 			if (param.direction == ParameterDirection.REF) {
-				stream.printf (" direction=\"inout\"");
 				// in/out paramter
-				if (param.parameter_type.value_owned) {
-					stream.printf (" transfer-ownership=\"full\"");
-				}
+				stream.printf (" direction=\"inout\"");
 			} else if (param.direction == ParameterDirection.OUT) {
 				// out paramter
 				stream.printf (" direction=\"out\"");
-				if (param.parameter_type.value_owned) {
-					stream.printf (" transfer-ownership=\"full\"");
-				}
 			} else {
 				// normal in paramter
-				if (param.parameter_type.value_owned) {
-					stream.printf (" transfer-ownership=\"full\"");
-				}
+			}
+			
+			// ownership
+			if (param.parameter_type.value_owned) {
+				stream.printf (" transfer-ownership=\"full\"");
+			} else {
+				stream.printf (" transfer-ownership=\"none\"");
 			}
 			stream.printf (">\n");
 			indent++;
@@ -485,6 +483,8 @@
 		stream.printf ("<return-value");
 		if (type.value_owned) {
 			stream.printf (" transfer-ownership=\"full\"");
+		} else {
+			stream.printf (" transfer-ownership=\"none\"");
 		}
 		stream.printf (">\n");
 		indent++;


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