[vala] codegen: Use _vala_ prefix for out parameters



commit 07ad39b7ba5db54aa9e7cc91035ff7d2c51f693b
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Jul 28 12:45:39 2011 +0200

    codegen: Use _vala_ prefix for out parameters
    
    Fixes bug 638310.

 codegen/valaccodememberaccessmodule.vala |    2 +-
 codegen/valaccodemethodmodule.vala       |    8 ++++----
 codegen/valagdbusclientmodule.vala       |    8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index ace7d34..e2c0a39 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -440,7 +440,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 				var type_as_struct = result.value_type.data_type as Struct;
 
 				if (param.direction == ParameterDirection.OUT) {
-					name = "_" + name;
+					name = "_vala_" + name;
 				}
 
 				if (param.direction == ParameterDirection.REF ||
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 4b756d5..7b675b9 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -452,7 +452,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
 						}
 					} else if (!m.coroutine) {
 						// declare local variable for out parameter to allow assignment even when caller passes NULL
-						var vardecl = new CCodeVariableDeclarator.zero (get_variable_cname ("_" + param.name), default_value_for_type (param.variable_type, true));
+						var vardecl = new CCodeVariableDeclarator.zero (get_variable_cname ("_vala_" + param.name), default_value_for_type (param.variable_type, true));
 						ccode.add_declaration (param.variable_type.get_cname (), vardecl);
 
 						if (param.variable_type is ArrayType) {
@@ -461,7 +461,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
 
 							if (!array_type.fixed_length) {
 								for (int dim = 1; dim <= array_type.rank; dim++) {
-									vardecl = new CCodeVariableDeclarator.zero (get_array_length_cname (get_variable_cname ("_" + param.name), dim), new CCodeConstant ("0"));
+									vardecl = new CCodeVariableDeclarator.zero (get_array_length_cname (get_variable_cname ("_vala_" + param.name), dim), new CCodeConstant ("0"));
 									ccode.add_declaration ("int", vardecl);
 								}
 							}
@@ -470,11 +470,11 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
 							var d = deleg_type.delegate_symbol;
 							if (d.has_target) {
 								// create variable to store delegate target
-								vardecl = new CCodeVariableDeclarator.zero (get_delegate_target_cname (get_variable_cname ("_" + param.name)), new CCodeConstant ("NULL"));
+								vardecl = new CCodeVariableDeclarator.zero (get_delegate_target_cname (get_variable_cname ("_vala_" + param.name)), new CCodeConstant ("NULL"));
 								ccode.add_declaration ("void *", vardecl);
 
 								if (deleg_type.value_owned) {
-									vardecl = new CCodeVariableDeclarator.zero (get_delegate_target_destroy_notify_cname (get_variable_cname ("_" + param.name)), new CCodeConstant ("NULL"));
+									vardecl = new CCodeVariableDeclarator.zero (get_delegate_target_destroy_notify_cname (get_variable_cname ("_vala_" + param.name)), new CCodeConstant ("NULL"));
 									ccode.add_declaration ("GDestroyNotify", vardecl);
 								}
 							}
diff --git a/codegen/valagdbusclientmodule.vala b/codegen/valagdbusclientmodule.vala
index 4f48750..23ba1c3 100644
--- a/codegen/valagdbusclientmodule.vala
+++ b/codegen/valagdbusclientmodule.vala
@@ -716,17 +716,17 @@ public class Vala.GDBusClientModule : GDBusModule {
 
 				foreach (Parameter param in m.get_parameters ()) {
 					if (param.direction == ParameterDirection.OUT) {
-						ccode.add_declaration (param.variable_type.get_cname (), new CCodeVariableDeclarator ("_" + param.name));
+						ccode.add_declaration (param.variable_type.get_cname (), new CCodeVariableDeclarator ("_vala_" + param.name));
 
 						var array_type = param.variable_type as ArrayType;
 
 						if (array_type != null) {
 							for (int dim = 1; dim <= array_type.rank; dim++) {
-								ccode.add_declaration ("int", new CCodeVariableDeclarator ("_%s_length%d".printf (param.name, dim), new CCodeConstant ("0")));
+								ccode.add_declaration ("int", new CCodeVariableDeclarator ("_vala_%s_length%d".printf (param.name, dim), new CCodeConstant ("0")));
 							}
 						}
 
-						var target = new CCodeIdentifier ("_" + param.name);
+						var target = new CCodeIdentifier ("_vala_" + param.name);
 						bool may_fail;
 						receive_dbus_value (param.variable_type, new CCodeIdentifier ("_reply_message"), new CCodeIdentifier ("_reply_iter"), target, param, new CCodeIdentifier ("error"), out may_fail);
 
@@ -737,7 +737,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 						if (array_type != null) {
 							for (int dim = 1; dim <= array_type.rank; dim++) {
 								// TODO check that parameter is not NULL (out parameters are optional)
-								ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("%s_length%d".printf (param.name, dim))), new CCodeIdentifier ("_%s_length%d".printf (param.name, dim)));
+								ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("%s_length%d".printf (param.name, dim))), new CCodeIdentifier ("_vala_%s_length%d".printf (param.name, dim)));
 							}
 						}
 



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