+2021-03-08 Tom Tromey <tom@tromey.com>
+
+ * expop.h (class func_static_var_operation): New.
+ * eval.c (eval_op_func_static_var): No longer static.
+
2021-03-08 Tom Tromey <tom@tromey.com>
* expop.h (class var_entry_value_operation): New.
/* Helper function that implements the body of OP_FUNC_STATIC_VAR. */
-static struct value *
+struct value *
eval_op_func_static_var (struct type *expect_type, struct expression *exp,
enum noside noside,
value *func, const char *var)
extern struct value *eval_op_var_entry_value (struct type *expect_type,
struct expression *exp,
enum noside noside, symbol *sym);
+extern struct value *eval_op_func_static_var (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside,
+ value *func, const char *var);
namespace expr
{
{ return OP_VAR_ENTRY_VALUE; }
};
+class func_static_var_operation
+ : public maybe_constant_operation<operation_up, std::string>
+{
+public:
+
+ using maybe_constant_operation::maybe_constant_operation;
+
+ value *evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside) override
+ {
+ value *func = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ return eval_op_func_static_var (expect_type, exp, noside, func,
+ std::get<1> (m_storage).c_str ());
+ }
+
+ enum exp_opcode opcode () const override
+ { return OP_FUNC_STATIC_VAR; }
+};
+
} /* namespace expr */
#endif /* EXPOP_H */