[vala/wip/transform2] Move set() call for element assignment to emit()



commit 3aa1f7c7d251c89097e005aa7583cd770c1a84a2
Author: Luca Bruno <lucabru src gnome org>
Date:   Mon Aug 29 10:35:49 2011 +0200

    Move set() call for element assignment to emit()

 vala/valaassignment.vala |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 41fbcfe..cbfaf83 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -198,12 +198,13 @@ public class Vala.Assignment : Expression {
 				right.target_type = new DelegateType (sig.get_delegate (ma.inner.value_type, this));
 			} else if (ea.container.value_type.get_member ("set") is Method) {
 				var set_call = new MethodCall (new MemberAccess (ea.container, "set", source_reference), source_reference);
+				set_call.parent_node = parent_node;
 				foreach (Expression e in ea.get_indices ()) {
 					set_call.add_argument (e);
 				}
 				set_call.add_argument (right);
-				parent_node.replace_expression (this, set_call);
-				return set_call.check (context);
+				error = !set_call.check (context);
+				return !error;
 			} else {
 				right.target_type = left.value_type;
 			}
@@ -525,6 +526,19 @@ public class Vala.Assignment : Expression {
 			// current codegen depends on it
 			// should be removed when moving codegen from
 			// visit_assignment to emit_store_element
+			var context = CodeContext.get ();
+			if (ea.container.value_type.get_member ("set") is Method) {
+				var set_call = new MethodCall (new MemberAccess (ea.container, "set", source_reference), source_reference);
+				set_call.parent_node = parent_node;
+				foreach (Expression e in ea.get_indices ()) {
+					set_call.add_argument (e);
+				}
+				set_call.add_argument (right);
+				set_call.check (context);
+				set_call.emit (codegen);
+				target_value = set_call.target_value;
+				return;
+			}
 			ea.emit (codegen);
 		} else if (pi != null) {
 			// always process full lvalue



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