summaryrefslogtreecommitdiffstats
path: root/core/class_db.cpp
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2017-08-09 11:54:27 +0200
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2017-08-10 07:17:44 +0200
commit46fdf163991f6f6893e00b301267c6ef2380008e (patch)
tree103e1b6f5bd5dfd3918a912286fefd6fdbdad12f /core/class_db.cpp
parent1536cc438128fe4036fa7da5ec305513a781d3c8 (diff)
downloadredot-engine-46fdf163991f6f6893e00b301267c6ef2380008e.tar.gz
Improves method bind detection of signature types
Diffstat (limited to 'core/class_db.cpp')
-rw-r--r--core/class_db.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp
index 24d71f86b0..f4ae1f3c52 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -1082,12 +1082,6 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const c
StringName mdname = StaticCString::create(method_name);
#endif
- StringName rettype;
- if (mdname.operator String().find(":") != -1) {
- rettype = mdname.operator String().get_slice(":", 1);
- mdname = mdname.operator String().get_slice(":", 0);
- }
-
OBJTYPE_WLOCK;
ERR_FAIL_COND_V(!p_bind, NULL);
p_bind->set_name(mdname);
@@ -1106,7 +1100,7 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const c
if (!type) {
ERR_PRINTS("Couldn't bind method '" + mdname + "' for instance: " + instance_type);
memdelete(p_bind);
- ERR_FAIL_COND_V(!type, NULL);
+ ERR_FAIL_V(NULL);
}
if (type->method_map.has(mdname)) {
@@ -1115,11 +1109,20 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const c
ERR_EXPLAIN("Method already bound: " + instance_type + "::" + mdname);
ERR_FAIL_V(NULL);
}
+
#ifdef DEBUG_METHODS_ENABLED
+
+ if (method_name.args.size() > p_bind->get_argument_count()) {
+ memdelete(p_bind);
+ ERR_EXPLAIN("Method definition provides more arguments than the method actually has: " + instance_type + "::" + mdname);
+ ERR_FAIL_V(NULL);
+ }
+
p_bind->set_argument_names(method_name.args);
- p_bind->set_return_type(rettype);
+
type->method_order.push_back(mdname);
#endif
+
type->method_map[mdname] = p_bind;
Vector<Variant> defvals;