remove confusing intermediate 'where' in evaluate_assignment()
diff mbox series

Message ID
State Mainlined, archived
Headers show
  • remove confusing intermediate 'where' in evaluate_assignment()
Related show

Commit Message

Luc Van Oostenryck Jan. 19, 2019, 11:52 p.m. UTC
In evaluate_assignment(), a local variable (named 'where') contains
the input expression (named 'expr', like in most other function).

This is doubly confusing because:
*) both variables hold the same pointer.
*) the name 'where' is normally used for a string with extra
   information for error messages.

So, remove this intermediate and use the original 'expr' instead.

Signed-off-by: Luc Van Oostenryck <>
 evaluate.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff mbox series

diff --git a/evaluate.c b/evaluate.c
index 947b121f4..53b66cc2d 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1577,7 +1577,6 @@  static void evaluate_assign_to(struct expression *left, struct symbol *type)
 static struct symbol *evaluate_assignment(struct expression *expr)
 	struct expression *left = expr->left;
-	struct expression *where = expr;
 	struct symbol *ltype;
 	if (!lvalue_expression(left)) {
@@ -1591,7 +1590,7 @@  static struct symbol *evaluate_assignment(struct expression *expr)
 		if (!evaluate_assign_op(expr))
 			return NULL;
 	} else {
-		if (!compatible_assignment_types(where, ltype, &expr->right, "assignment"))
+		if (!compatible_assignment_types(expr, ltype, &expr->right, "assignment"))
 			return NULL;