[vala] codegen: Avoid writing C statements with no effect
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Avoid writing C statements with no effect
- Date: Tue, 21 Dec 2010 18:02:48 +0000 (UTC)
commit 99b8af6abf30f86a1e48848ee6add9b260eb6152
Author: Jürg Billeter <j bitron ch>
Date: Tue Dec 21 16:46:37 2010 +0100
codegen: Avoid writing C statements with no effect
codegen/valaccodeassignmentmodule.vala | 12 ++----------
codegen/valaccodebasemodule.vala | 4 ----
2 files changed, 2 insertions(+), 14 deletions(-)
---
diff --git a/codegen/valaccodeassignmentmodule.vala b/codegen/valaccodeassignmentmodule.vala
index 5c93d71..0278e9e 100644
--- a/codegen/valaccodeassignmentmodule.vala
+++ b/codegen/valaccodeassignmentmodule.vala
@@ -180,11 +180,7 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
ccode.add_expression (codenode);
- if (assignment.parent_node is ExpressionStatement) {
- return null;
- } else {
- return lhs;
- }
+ return lhs;
}
CCodeExpression? emit_fixed_length_array_assignment (Assignment assignment, ArrayType array_type) {
@@ -205,11 +201,7 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
ccode.add_expression (ccopy);
- if (assignment.parent_node is ExpressionStatement) {
- return null;
- } else {
- return lhs;
- }
+ return lhs;
}
public override void visit_assignment (Assignment assignment) {
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index abd7d0e..bc7af35 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3170,10 +3170,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
return;
}
- if (get_cvalue (stmt.expression) != null) {
- ccode.add_expression (get_cvalue (stmt.expression));
- }
-
/* free temporary objects and handle errors */
foreach (LocalVariable local in temp_ref_vars) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]