[vala] codegen: Cast to field or parameter ctype on assignment
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Cast to field or parameter ctype on assignment
- Date: Sat, 30 Apr 2011 21:07:18 +0000 (UTC)
commit afa8e7d2f651f3eca8f70a56a27a62713a76e172
Author: Luca Bruno <lucabru src gnome org>
Date: Sat Apr 30 21:53:23 2011 +0200
codegen: Cast to field or parameter ctype on assignment
codegen/valaccodeassignmentmodule.vala | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodeassignmentmodule.vala b/codegen/valaccodeassignmentmodule.vala
index 2b009d5..43b9dba 100644
--- a/codegen/valaccodeassignmentmodule.vala
+++ b/codegen/valaccodeassignmentmodule.vala
@@ -206,7 +206,20 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
return;
}
- ccode.add_assignment (get_cvalue_ (lvalue), get_cvalue_ (value));
+ string ctype;
+ if (variable is Field) {
+ ctype = ((Field) variable).get_ctype ();
+ } else if (variable is Parameter) {
+ ctype = ((Parameter) variable).ctype;
+ } else {
+ ctype = null;
+ }
+ var cexpr = get_cvalue_ (value);
+ if (ctype != null) {
+ cexpr = new CCodeCastExpression (cexpr, ctype);
+ }
+
+ ccode.add_assignment (get_cvalue_ (lvalue), cexpr);
if (array_type != null && !variable.no_array_length) {
var glib_value = (GLibValue) value;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]