[vala/staging] vala: Minor clean up assignment to binary expression transformation
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] vala: Minor clean up assignment to binary expression transformation
- Date: Thu, 22 Nov 2018 14:14:53 +0000 (UTC)
commit 71d799267cf5a72d0e6739cdc6fd238834749fa3
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Nov 22 13:05:04 2018 +0100
vala: Minor clean up assignment to binary expression transformation
vala/valaassignment.vala | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 7e873942d..81a7139ba 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -229,24 +229,27 @@ public class Vala.Assignment : Expression {
var old_value = new MemberAccess (ma.inner, ma.member_name);
- var bin = new BinaryExpression (BinaryOperator.PLUS, old_value, right,
source_reference);
- bin.target_type = right.target_type.copy ();
- right.target_type = right.target_type.copy ();
- right.target_type.value_owned = false;
+ BinaryOperator bop;
switch (operator) {
- case AssignmentOperator.BITWISE_OR: bin.operator = BinaryOperator.BITWISE_OR; break;
- case AssignmentOperator.BITWISE_AND: bin.operator = BinaryOperator.BITWISE_AND; break;
- case AssignmentOperator.BITWISE_XOR: bin.operator = BinaryOperator.BITWISE_XOR; break;
- case AssignmentOperator.ADD: bin.operator = BinaryOperator.PLUS; break;
- case AssignmentOperator.SUB: bin.operator = BinaryOperator.MINUS; break;
- case AssignmentOperator.MUL: bin.operator = BinaryOperator.MUL; break;
- case AssignmentOperator.DIV: bin.operator = BinaryOperator.DIV; break;
- case AssignmentOperator.PERCENT: bin.operator = BinaryOperator.MOD; break;
- case AssignmentOperator.SHIFT_LEFT: bin.operator = BinaryOperator.SHIFT_LEFT; break;
- case AssignmentOperator.SHIFT_RIGHT: bin.operator = BinaryOperator.SHIFT_RIGHT; break;
+ case AssignmentOperator.BITWISE_OR: bop = BinaryOperator.BITWISE_OR; break;
+ case AssignmentOperator.BITWISE_AND: bop = BinaryOperator.BITWISE_AND; break;
+ case AssignmentOperator.BITWISE_XOR: bop = BinaryOperator.BITWISE_XOR; break;
+ case AssignmentOperator.ADD: bop = BinaryOperator.PLUS; break;
+ case AssignmentOperator.SUB: bop = BinaryOperator.MINUS; break;
+ case AssignmentOperator.MUL: bop = BinaryOperator.MUL; break;
+ case AssignmentOperator.DIV: bop = BinaryOperator.DIV; break;
+ case AssignmentOperator.PERCENT: bop = BinaryOperator.MOD; break;
+ case AssignmentOperator.SHIFT_LEFT: bop = BinaryOperator.SHIFT_LEFT; break;
+ case AssignmentOperator.SHIFT_RIGHT: bop = BinaryOperator.SHIFT_RIGHT; break;
+ default: assert_not_reached ();
}
+ var bin = new BinaryExpression (bop, old_value, right, source_reference);
+ bin.target_type = right.target_type;
+ right.target_type = right.target_type.copy ();
+ right.target_type.value_owned = false;
+
right = bin;
right.check (context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]