More robust handling of potential class object member types
This commit is contained in:
@@ -83,6 +83,19 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used internally for handling a return value from a Proxy_Function call
|
||||||
|
*/
|
||||||
|
template<>
|
||||||
|
struct Handle_Return<const Boxed_Value &>
|
||||||
|
{
|
||||||
|
static Boxed_Value handle(const Boxed_Value &r)
|
||||||
|
{
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used internally for handling a return value from a Proxy_Function call
|
* Used internally for handling a return value from a Proxy_Function call
|
||||||
*/
|
*/
|
||||||
|
@@ -442,10 +442,11 @@ namespace chaiscript
|
|||||||
if (bv.is_const())
|
if (bv.is_const())
|
||||||
{
|
{
|
||||||
const Class *o = boxed_cast<const Class *>(bv);
|
const Class *o = boxed_cast<const Class *>(bv);
|
||||||
return Boxed_Value( boost::ref(o->*m_attr) );
|
return Handle_Return<typename boost::add_const<typename boost::add_reference<T>::type>::type>::handle(o->*m_attr);
|
||||||
} else {
|
} else {
|
||||||
Class *o = boxed_cast<Class *>(bv);
|
Class *o = boxed_cast<Class *>(bv);
|
||||||
return Boxed_Value( boost::ref(o->*m_attr) );
|
return Handle_Return<typename boost::add_reference<T>::type>::handle(o->*m_attr);
|
||||||
|
// return Boxed_Value( boost::ref(o->*m_attr) );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw arity_error(params.size(), 1);
|
throw arity_error(params.size(), 1);
|
||||||
|
Reference in New Issue
Block a user