diff options
author | K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com> | 2022-06-27 13:10:04 -0700 |
---|---|---|
committer | K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com> | 2022-06-27 13:33:06 -0700 |
commit | 9ddebc0c22866d6b7a7ff3fa64b67cc86c8664da (patch) | |
tree | 3bb41cb3143f197ca53ee93f7375598ef5886ec6 /core/math/expression.h | |
parent | c41e4b10c3317f837d4b3ece2fb725a8067d884b (diff) | |
download | redot-engine-9ddebc0c22866d6b7a7ff3fa64b67cc86c8664da.tar.gz |
Add a const call mode to Object, Variant and Script.
For this to work safely (user not call queue_free or something in the expression), a const call mode was added to Object and Variant (and optionally Script).
This mode ensures only const functions can be called, making it safe to use from the editor.
Co-Authored-By: reduz <reduzio@gmail.com>
Diffstat (limited to 'core/math/expression.h')
-rw-r--r-- | core/math/expression.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/math/expression.h b/core/math/expression.h index 6ea3c1611f..2d58915996 100644 --- a/core/math/expression.h +++ b/core/math/expression.h @@ -257,14 +257,14 @@ private: Vector<String> input_names; bool execution_error = false; - bool _execute(const Array &p_inputs, Object *p_instance, Expression::ENode *p_node, Variant &r_ret, String &r_error_str); + bool _execute(const Array &p_inputs, Object *p_instance, Expression::ENode *p_node, Variant &r_ret, bool p_const_calls_only, String &r_error_str); protected: static void _bind_methods(); public: Error parse(const String &p_expression, const Vector<String> &p_input_names = Vector<String>()); - Variant execute(Array p_inputs = Array(), Object *p_base = nullptr, bool p_show_error = true); + Variant execute(Array p_inputs = Array(), Object *p_base = nullptr, bool p_show_error = true, bool p_const_calls_only = false); bool has_execute_failed() const; String get_error_text() const; |