enum exp_opcode opcode,
struct value *ncopies,
struct value *elt);
-extern struct value *eval_op_rust_ind (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *value);
extern struct value *rust_subscript (struct type *expect_type,
struct expression *exp,
enum noside noside, bool for_addr,
struct expression *exp,
enum noside noside, enum range_flag kind,
struct value *low, struct value *high);
-extern struct value *eval_op_rust_struct_anon (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- int field_number,
- struct value *lhs);
-extern struct value *eval_op_rust_structop (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- struct value *lhs,
- const char *field_name);
namespace expr
{
value *evaluate (struct type *expect_type,
struct expression *exp,
- enum noside noside) override
- {
- if (noside != EVAL_NORMAL)
- return unop_ind_operation::evaluate (expect_type, exp, noside);
-
- value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- return eval_op_rust_ind (expect_type, exp, noside, UNOP_IND, arg1);
- }
+ enum noside noside) override;
};
/* Subscript operator for Rust. */
value *evaluate (struct type *expect_type,
struct expression *exp,
- enum noside noside) override
- {
- value *lhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
- return eval_op_rust_struct_anon (expect_type, exp, noside,
- std::get<0> (m_storage), lhs);
-
- }
+ enum noside noside) override;
enum exp_opcode opcode () const override
{ return STRUCTOP_ANONYMOUS; }
value *evaluate (struct type *expect_type,
struct expression *exp,
- enum noside noside) override
- {
- value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- return eval_op_rust_structop (expect_type, exp, noside, lhs,
- std::get<1> (m_storage).c_str ());
- }
+ enum noside noside) override;
value *evaluate_funcall (struct type *expect_type,
struct expression *exp,
return result;
}
-/* A helper function for UNOP_IND. */
+namespace expr
+{
struct value *
-eval_op_rust_ind (struct type *expect_type, struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *value)
+rust_unop_ind_operation::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
{
- gdb_assert (noside == EVAL_NORMAL);
+ if (noside != EVAL_NORMAL)
+ return unop_ind_operation::evaluate (expect_type, exp, noside);
+
+ struct value *value = std::get<0> (m_storage)->evaluate (nullptr, exp,
+ noside);
struct value *trait_ptr = rust_get_trait_object_pointer (value);
if (trait_ptr != NULL)
value = trait_ptr;
return value_ind (value);
}
+} /* namespace expr */
+
/* A helper function for UNOP_COMPLEMENT. */
struct value *
}
}
-/* A helper function for STRUCTOP_ANONYMOUS. */
+namespace expr
+{
struct value *
-eval_op_rust_struct_anon (struct type *expect_type, struct expression *exp,
- enum noside noside,
- int field_number, struct value *lhs)
+rust_struct_anon::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
{
+ value *lhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
+ int field_number = std::get<0> (m_storage);
+
struct type *type = value_type (lhs);
if (type->code () == TYPE_CODE_STRUCT)
tuple structs, and tuple-like enum variants"));
}
-/* A helper function for STRUCTOP_STRUCT. */
-
struct value *
-eval_op_rust_structop (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct value *lhs, const char *field_name)
+rust_structop::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
{
+ value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ const char *field_name = std::get<1> (m_storage).c_str ();
+
struct value *result;
struct type *type = value_type (lhs);
if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type))
return result;
}
-namespace expr
-{
-
value *
rust_aggregate_operation::evaluate (struct type *expect_type,
struct expression *exp,