diff options
author | reduz <reduzio@gmail.com> | 2020-11-11 13:16:08 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2020-11-11 16:36:36 -0300 |
commit | 635d33dc6cb2226135fadeca3a2082a3c24c3757 (patch) | |
tree | db003f23139e8928c97e9033571a43f76a7ec47a /core/math/expression.cpp | |
parent | fb2151089cea5da6c2293894f9686db6d50fbf92 (diff) |
Refactor variant built-in methods yet again.
* Using C-style function pointers now, InternalMethod is gone.
* This ensures much better performance in typed code.
* Renamed builtin_funcs to utility_funcs, to avoid naming confusion
Diffstat (limited to 'core/math/expression.cpp')
-rw-r--r-- | core/math/expression.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 13c8904f7e..d1f15caa5e 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -410,7 +410,7 @@ Error Expression::_get_token(Token &r_token) { } else if (id == "self") { r_token.type = TK_SELF; } else { - if (Variant::has_builtin_func(id)) { + if (Variant::has_utility_function(id)) { r_token.type = TK_BUILTIN_FUNC; r_token.value = id; return OK; @@ -747,8 +747,8 @@ Expression::ENode *Expression::_parse_expression() { } } - if (!Variant::is_builtin_func_vararg(bifunc->func)) { - int expected_args = Variant::get_builtin_func_argument_count(bifunc->func); + if (!Variant::is_utility_function_vararg(bifunc->func)) { + int expected_args = Variant::get_utility_function_argument_count(bifunc->func); if (expected_args != bifunc->arguments.size()) { _set_error("Builtin func '" + String(bifunc->func) + "' expects " + itos(expected_args) + " arguments."); } @@ -1362,7 +1362,7 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression: r_ret = Variant(); //may not return anything Callable::CallError ce; - Variant::call_builtin_func(bifunc->func, &r_ret, (const Variant **)argp.ptr(), argp.size(), ce); + Variant::call_utility_function(bifunc->func, &r_ret, (const Variant **)argp.ptr(), argp.size(), ce); if (ce.error != Callable::CallError::CALL_OK) { r_error_str = "Builtin Call Failed. " + Variant::get_call_error_text(bifunc->func, (const Variant **)argp.ptr(), argp.size(), ce); return true; @@ -1396,7 +1396,7 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression: } Callable::CallError ce; - r_ret = base.call(call->method, (const Variant **)argp.ptr(), argp.size(), ce); + base.call(call->method, (const Variant **)argp.ptr(), argp.size(), r_ret, ce); if (ce.error != Callable::CallError::CALL_OK) { r_error_str = vformat(RTR("On call to '%s':"), String(call->method)); |