summaryrefslogtreecommitdiff
path: root/codegen/valaccodecontrolflowmodule.vala
diff options
context:
space:
mode:
authorLuca Bruno <lucabru@src.gnome.org>2011-06-14 16:25:07 +0200
committerLuca Bruno <lucabru@src.gnome.org>2011-07-06 22:32:33 +0200
commit62866f2e8c32b8068a46b9b4e5635567e97f8c90 (patch)
tree06f9dc0835577c7ff0d41e806937bc7043ce9de9 /codegen/valaccodecontrolflowmodule.vala
parent97b23cbbe96b5f2b7fab599ebf89de9523595643 (diff)
downloadvala-62866f2e8c32b8068a46b9b4e5635567e97f8c90.tar.gz
codegen: Use create_temp_value in visit_string_switch_statement
Diffstat (limited to 'codegen/valaccodecontrolflowmodule.vala')
-rw-r--r--codegen/valaccodecontrolflowmodule.vala16
1 files changed, 8 insertions, 8 deletions
diff --git a/codegen/valaccodecontrolflowmodule.vala b/codegen/valaccodecontrolflowmodule.vala
index 46c8ed13f..17ded5816 100644
--- a/codegen/valaccodecontrolflowmodule.vala
+++ b/codegen/valaccodecontrolflowmodule.vala
@@ -40,10 +40,9 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
void visit_string_switch_statement (SwitchStatement stmt) {
// we need a temporary variable to save the property value
- var temp_var = get_temp_variable (stmt.expression.value_type, stmt.expression.value_type.value_owned, stmt, false);
- emit_temp_var (temp_var);
+ var temp_value = create_temp_value (stmt.expression.value_type, false, stmt);
+ var ctemp = get_cvalue_ (temp_value);
- var ctemp = get_variable_cexpression (temp_var.name);
var cinit = new CCodeAssignment (ctemp, get_cvalue (stmt.expression));
var czero = new CCodeConstant ("0");
@@ -56,8 +55,9 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
var ccond = new CCodeConditionalExpression (cisnull, new CCodeConstant ("0"), cquark);
- temp_var = get_temp_variable (gquark_type);
- emit_temp_var (temp_var);
+ int label_temp_id = next_temp_var_id++;
+
+ temp_value = create_temp_value (gquark_type, true, stmt);
int label_count = 0;
@@ -71,7 +71,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
var cexpr = get_cvalue (label.expression);
if (is_constant_ccode_expression (cexpr)) {
- var cname = "%s_label%d".printf (temp_var.name, label_count++);
+ var cname = "_tmp%d_label%d".printf (label_temp_id, label_count++);
ccode.add_declaration (gquark_type.get_cname (), new CCodeVariableDeclarator (cname, czero), CCodeModifiers.STATIC);
}
@@ -80,7 +80,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
ccode.add_expression (cinit);
- ctemp = get_variable_cexpression (temp_var.name);
+ ctemp = get_cvalue_ (temp_value);
cinit = new CCodeAssignment (ctemp, ccond);
ccode.add_expression (cinit);
@@ -107,7 +107,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
var cexpr = get_cvalue (label.expression);
if (is_constant_ccode_expression (cexpr)) {
- var cname = new CCodeIdentifier ("%s_label%d".printf (temp_var.name, label_count++));
+ var cname = new CCodeIdentifier ("_tmp%d_label%d".printf (label_temp_id, label_count++));
var ccondition = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, czero, cname);
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_quark_from_static_string"));
cinit = new CCodeAssignment (cname, ccall);