1 /* Definitions for Modula-2 expressions
3 Copyright (C) 2020-2024 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 extern struct value
*eval_op_m2_high (struct type
*expect_type
,
26 struct expression
*exp
,
29 extern struct value
*eval_op_m2_subscript (struct type
*expect_type
,
30 struct expression
*exp
,
38 /* The Modula-2 "HIGH" operation. */
39 class m2_unop_high_operation
40 : public tuple_holding_operation
<operation_up
>
44 using tuple_holding_operation::tuple_holding_operation
;
46 value
*evaluate (struct type
*expect_type
,
47 struct expression
*exp
,
48 enum noside noside
) override
50 value
*arg1
= std::get
<0> (m_storage
)->evaluate_with_coercion (exp
,
52 return eval_op_m2_high (expect_type
, exp
, noside
, arg1
);
55 enum exp_opcode
opcode () const override
59 /* Subscripting for Modula-2. */
60 class m2_binop_subscript_operation
61 : public tuple_holding_operation
<operation_up
, operation_up
>
65 using tuple_holding_operation::tuple_holding_operation
;
67 value
*evaluate (struct type
*expect_type
,
68 struct expression
*exp
,
69 enum noside noside
) override
71 value
*arg1
= std::get
<0> (m_storage
)->evaluate_with_coercion (exp
,
73 value
*arg2
= std::get
<1> (m_storage
)->evaluate_with_coercion (exp
,
75 return eval_op_m2_subscript (expect_type
, exp
, noside
, arg1
, arg2
);
78 enum exp_opcode
opcode () const override
79 { return BINOP_SUBSCRIPT
; }
82 } /* namespace expr */