[vala/wip/effectfree: 26/43] codegen: Drop useless temporary variable in visit_cast_expression



commit e445aed026c09af9c6c543a9b65bc153d6a2660c
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat Jun 11 12:09:11 2011 +0200

    codegen: Drop useless temporary variable in visit_cast_expression

 codegen/valaccodebasemodule.vala |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 73cac61..0941cf7 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4577,15 +4577,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		if (context.profile == Profile.GOBJECT && (iface != null || (cl != null && !cl.is_compact))) {
 			// checked cast for strict subtypes of GTypeInstance
 			if (expr.is_silent_cast) {
-				var temp_decl = get_temp_variable (expr.inner.value_type, expr.inner.value_type.value_owned, expr, false);
-				emit_temp_var (temp_decl);
-				var ctemp = get_variable_cexpression (temp_decl.name);
-
-				ccode.add_assignment (ctemp, get_cvalue (expr.inner));
-				var ccheck = create_type_check (ctemp, expr.type_reference);
-				var ccast = new CCodeCastExpression (ctemp, expr.type_reference.get_cname ());
+				var cexpr = get_cvalue (expr.inner);
+				var ccheck = create_type_check (cexpr, expr.type_reference);
+				var ccast = new CCodeCastExpression (cexpr, expr.type_reference.get_cname ());
 				var cnull = new CCodeConstant ("NULL");
-	
+
 				set_cvalue (expr, new CCodeConditionalExpression (ccheck, ccast, cnull));
 			} else {
 				set_cvalue (expr, generate_instance_cast (get_cvalue (expr.inner), expr.type_reference.data_type));



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