+2021-03-08 Tom Tromey <tom@tromey.com>
+
+ * rust-lang.c (eval_op_rust_ind): New function.
+ (rust_evaluate_subexp): Use it.
+
2021-03-08 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_subscript): Change parameters.
return result;
}
+/* A helper function for UNOP_IND. */
+
+static struct value *
+eval_op_rust_ind (struct type *expect_type, struct expression *exp,
+ enum noside noside,
+ struct value *value)
+{
+ gdb_assert (noside == EVAL_NORMAL);
+ struct value *trait_ptr = rust_get_trait_object_pointer (value);
+ if (trait_ptr != NULL)
+ value = trait_ptr;
+
+ return value_ind (value);
+}
+
/* evaluate_exp implementation for Rust. */
static struct value *
++*pos;
struct value *value = evaluate_subexp (expect_type, exp, pos,
noside);
-
- struct value *trait_ptr = rust_get_trait_object_pointer (value);
- if (trait_ptr != NULL)
- value = trait_ptr;
-
- result = value_ind (value);
+ result = eval_op_rust_ind (expect_type, exp, noside, value);
}
}
break;