summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-20 01:15:02 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-20 01:15:02 -0300
commit5e816fd8c8e8c97e22f636573667a99ac705e56c (patch)
tree0d224c31f6c3abd7bb40fb5cf9f107d57ae0e494 /core
parent6e9e57beaa7876479a629c32a31c98f7699b9773 (diff)
Property reporty base type when a function fails, fixes #4581 probably also closes other issues
Diffstat (limited to 'core')
-rw-r--r--core/variant.h1
-rw-r--r--core/variant_call.cpp17
2 files changed, 13 insertions, 5 deletions
diff --git a/core/variant.h b/core/variant.h
index 9c93ecb73b..87bf20f8ee 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -385,6 +385,7 @@ public:
Type expected;
};
+ void call_ptr(const StringName& p_method,const Variant** p_args,int p_argcount,Variant* r_ret,CallError &r_error);
Variant call(const StringName& p_method,const Variant** p_args,int p_argcount,CallError &r_error);
Variant call(const StringName& p_method,const Variant& p_arg1=Variant(),const Variant& p_arg2=Variant(),const Variant& p_arg3=Variant(),const Variant& p_arg4=Variant(),const Variant& p_arg5=Variant());
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 0055138582..29a92febbd 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -937,26 +937,32 @@ _VariantCall::ConstantData* _VariantCall::constant_data=NULL;
Variant Variant::call(const StringName& p_method,const Variant** p_args,int p_argcount,CallError &r_error) {
Variant ret;
+ call_ptr(p_method,p_args,p_argcount,&ret,r_error);
+ return ret;
+}
+
+void Variant::call_ptr(const StringName& p_method,const Variant** p_args,int p_argcount,Variant* r_ret,CallError &r_error) {
+ Variant ret;
if (type==Variant::OBJECT) {
//call object
Object *obj = _get_obj().obj;
if (!obj) {
r_error.error=CallError::CALL_ERROR_INSTANCE_IS_NULL;
- return ret;
+ return;
}
#ifdef DEBUG_ENABLED
if (ScriptDebugger::get_singleton() && _get_obj().ref.is_null()) {
//only if debugging!
if (!ObjectDB::instance_validate(obj)) {
r_error.error=CallError::CALL_ERROR_INSTANCE_IS_NULL;
- return ret;
+ return;
}
}
#endif
- return _get_obj().obj->call(p_method,p_args,p_argcount,r_error);
+ ret=_get_obj().obj->call(p_method,p_args,p_argcount,r_error);
//else if (type==Variant::METHOD) {
@@ -968,14 +974,15 @@ Variant Variant::call(const StringName& p_method,const Variant** p_args,int p_ar
#ifdef DEBUG_ENABLED
if (!E) {
r_error.error=Variant::CallError::CALL_ERROR_INVALID_METHOD;
- return Variant();
+ return;
}
#endif
_VariantCall::FuncData& funcdata = E->get();
funcdata.call(ret,*this,p_args,p_argcount,r_error);
}
- return ret;
+ if (r_error.error==Variant::CallError::CALL_OK && r_ret)
+ *r_ret=ret;
}
#define VCALL(m_type,m_method) _VariantCall::_call_##m_type##_##m_method