Introduce ada_ternop_range_operation

This adds class ada_ternop_range_operation, which implements
TERNOP_IN_RANGE.

gdb/ChangeLog
2021-03-08  Tom Tromey  <tom@tromey.com>

	* ada-lang.c (ada_ternop_range_operation::evaluate): New method.
	* ada-exp.h (class ada_ternop_range_operation): New.
This commit is contained in:
Tom Tromey 2021-03-08 07:27:57 -07:00
parent cc6bd32eea
commit fc715eb288
3 changed files with 32 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2021-03-08 Tom Tromey <tom@tromey.com>
* ada-lang.c (ada_ternop_range_operation::evaluate): New method.
* ada-exp.h (class ada_ternop_range_operation): New.
2021-03-08 Tom Tromey <tom@tromey.com>
* ada-lang.c (ada_qual_operation::evaluate): New method.

View file

@ -71,6 +71,22 @@ public:
{ return UNOP_QUAL; }
};
/* Ternary in-range operator. */
class ada_ternop_range_operation
: public tuple_holding_operation<operation_up, operation_up, operation_up>
{
public:
using tuple_holding_operation::tuple_holding_operation;
value *evaluate (struct type *expect_type,
struct expression *exp,
enum noside noside) override;
enum exp_opcode opcode () const override
{ return TERNOP_IN_RANGE; }
};
} /* namespace expr */
#endif /* ADA_EXP_H */

View file

@ -10436,6 +10436,17 @@ ada_qual_operation::evaluate (struct type *expect_type,
return std::get<0> (m_storage)->evaluate (type, exp, noside);
}
value *
ada_ternop_range_operation::evaluate (struct type *expect_type,
struct expression *exp,
enum noside noside)
{
value *arg0 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
value *arg2 = std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
return eval_ternop_in_range (expect_type, exp, noside, arg0, arg1, arg2);
}
}
/* Implement the evaluate_exp routine in the exp_descriptor structure