[vala/wip/effectfree: 20/38] codegen: Drop useless temp variable when accessing base methods



commit c002e63a305ba27593fd68128fad683f9c362f8f
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat Jun 18 14:50:45 2011 +0200

    codegen: Drop useless temp variable when accessing base methods

 codegen/valaccodememberaccessmodule.vala |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)
---
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 203a729..8eb6c0e 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -67,19 +67,9 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
 
 			if (m.base_method != null) {
 				if (!method_has_wrapper (m.base_method)) {
-					var inst = pub_inst;
-					if (expr.inner != null && !expr.inner.is_pure ()) {
-						// instance expression has side-effects
-						// store in temp. variable
-						var temp_var = get_temp_variable (expr.inner.value_type, true, null, false);
-						emit_temp_var (temp_var);
-						var ctemp = get_variable_cexpression (temp_var.name);
-						inst = new CCodeAssignment (ctemp, pub_inst);
-						set_cvalue (expr.inner, ctemp);
-					}
 					var base_class = (Class) m.base_method.parent_symbol;
 					var vclass = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_CLASS".printf (base_class.get_upper_case_cname (null))));
-					vclass.add_argument (inst);
+					vclass.add_argument (pub_inst);
 					set_cvalue (expr, new CCodeMemberAccess.pointer (vclass, m.name));
 				} else {
 					set_cvalue (expr, new CCodeIdentifier (m.base_method.get_cname ()));



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