summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
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 683b1611d8..84015d2b04 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -939,26 +939,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) {
@@ -970,14 +976,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