summaryrefslogtreecommitdiff
path: root/core/method_bind.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 13:23:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch)
treea27e497da7104dd0a64f98a04fa3067668735e91 /core/method_bind.h
parent710b34b70227becdc652b4ae027fe0ac47409642 (diff)
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
Diffstat (limited to 'core/method_bind.h')
-rw-r--r--core/method_bind.h18
1 files changed, 0 insertions, 18 deletions
diff --git a/core/method_bind.h b/core/method_bind.h
index 0092527a25..7f3da9c25e 100644
--- a/core/method_bind.h
+++ b/core/method_bind.h
@@ -59,27 +59,21 @@ enum MethodFlags {
template <class T>
struct VariantCaster {
-
static _FORCE_INLINE_ T cast(const Variant &p_variant) {
-
return p_variant;
}
};
template <class T>
struct VariantCaster<T &> {
-
static _FORCE_INLINE_ T cast(const Variant &p_variant) {
-
return p_variant;
}
};
template <class T>
struct VariantCaster<const T &> {
-
static _FORCE_INLINE_ T cast(const Variant &p_variant) {
-
return p_variant;
}
};
@@ -93,7 +87,6 @@ struct VariantCaster<const T &> {
MAKE_ENUM_TYPE_INFO(m_enum) \
template <> \
struct VariantCaster<m_enum> { \
- \
static _FORCE_INLINE_ m_enum cast(const Variant &p_variant) { \
return (m_enum)p_variant.operator int(); \
} \
@@ -114,7 +107,6 @@ struct VariantCaster<const T &> {
MAKE_ENUM_TYPE_INFO(m_enum) \
template <> \
struct VariantCaster<m_enum> { \
- \
static _FORCE_INLINE_ m_enum cast(const Variant &p_variant) { \
return (m_enum)p_variant.operator int(); \
} \
@@ -206,7 +198,6 @@ struct PtrToArg<wchar_t> {
#endif
class MethodBind {
-
int method_id;
uint32_t hint_flags = METHOD_FLAGS_DEFAULT;
StringName name;
@@ -237,7 +228,6 @@ public:
_FORCE_INLINE_ int get_default_argument_count() const { return default_argument_count; }
_FORCE_INLINE_ Variant has_default_argument(int p_arg) const {
-
int idx = argument_count - p_arg - 1;
if (idx < 0 || idx >= default_arguments.size())
@@ -247,7 +237,6 @@ public:
}
_FORCE_INLINE_ Variant get_default_argument(int p_arg) const {
-
int idx = argument_count - p_arg - 1;
if (idx < 0 || idx >= default_arguments.size())
@@ -259,7 +248,6 @@ public:
#ifdef DEBUG_METHODS_ENABLED
_FORCE_INLINE_ Variant::Type get_argument_type(int p_argument) const {
-
ERR_FAIL_COND_V(p_argument < -1 || p_argument > argument_count, Variant::NIL);
return argument_types[p_argument + 1];
}
@@ -313,7 +301,6 @@ public:
#ifdef DEBUG_METHODS_ENABLED
virtual PropertyInfo _gen_argument_type_info(int p_arg) const {
-
if (p_arg < 0) {
return arguments.return_val;
} else if (p_arg < arguments.arguments.size()) {
@@ -339,23 +326,19 @@ public:
#endif
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
-
T *instance = static_cast<T *>(p_object);
return (instance->*call_method)(p_args, p_arg_count, r_error);
}
void set_method_info(const MethodInfo &p_info, bool p_return_nil_is_variant) {
-
set_argument_count(p_info.arguments.size());
#ifdef DEBUG_METHODS_ENABLED
Variant::Type *at = memnew_arr(Variant::Type, p_info.arguments.size() + 1);
at[0] = p_info.return_val.type;
if (p_info.arguments.size()) {
-
Vector<StringName> names;
names.resize(p_info.arguments.size());
for (int i = 0; i < p_info.arguments.size(); i++) {
-
at[i + 1] = p_info.arguments[i].type;
names.write[i] = p_info.arguments[i].name;
}
@@ -389,7 +372,6 @@ public:
template <class T>
MethodBind *create_vararg_method_bind(Variant (T::*p_method)(const Variant **, int, Callable::CallError &), const MethodInfo &p_info, bool p_return_nil_is_variant) {
-
MethodBindVarArg<T> *a = memnew((MethodBindVarArg<T>));
a->set_method(p_method);
a->set_method_info(p_info, p_return_nil_is_variant);