[vala/wip/effectfree: 21/39] codegen: Drop useless temporary variable in visit_cast_expression
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/effectfree: 21/39] codegen: Drop useless temporary variable in visit_cast_expression
- Date: Fri, 1 Jul 2011 07:51:30 +0000 (UTC)
commit c342e7e4bde153cb5fd8210115086dff629017a7
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 fac73ee..60c37dd 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4567,15 +4567,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]