Implement test for function ordering for dispatch. Catch bug for "const" characterization of function parameters. Add test for type characterizations.

This commit is contained in:
Jason Turner
2010-12-13 03:32:47 +00:00
parent e90d49bb9d
commit 660e978da3
6 changed files with 116 additions and 1 deletions

View File

@@ -814,6 +814,35 @@ namespace chaiscript
const Type_Info boxed_type = user_type<Boxed_Value>();
const Type_Info boxed_pod_type = user_type<Boxed_POD_Value>();
boost::shared_ptr<const Dynamic_Proxy_Function> dynamic_lhs(boost::dynamic_pointer_cast<const Dynamic_Proxy_Function>(lhs));
boost::shared_ptr<const Dynamic_Proxy_Function> dynamic_rhs(boost::dynamic_pointer_cast<const Dynamic_Proxy_Function>(rhs));
if (dynamic_lhs && dynamic_rhs)
{
if (dynamic_lhs->get_guard())
{
if (dynamic_rhs->get_guard())
{
return false;
} else {
return true;
}
} else {
return false;
}
}
if (dynamic_lhs && !dynamic_rhs)
{
return false;
}
if (!dynamic_lhs && dynamic_rhs)
{
return true;
}
for (int i = 1; i < lhssize && i < rhssize; ++i)
{

View File

@@ -221,6 +221,11 @@ namespace chaiscript
return m_arity;
}
Proxy_Function get_guard() const
{
return m_guard;
}
virtual std::string annotation() const
{
return m_description;

View File

@@ -7,6 +7,9 @@
#ifndef __type_info_hpp__
#define __type_info_hpp__
#include <string>
#include <typeinfo>
#include <boost/shared_ptr.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_void.hpp>
#include <boost/type_traits/is_reference.hpp>
@@ -139,7 +142,7 @@ namespace chaiscript
static Type_Info get()
{
return Type_Info(boost::is_const<T>::value, boost::is_reference<T>::value, boost::is_pointer<T>::value,
return Type_Info(boost::is_const<typename boost::remove_pointer<typename boost::remove_reference<T>::type>::type>::value, boost::is_reference<T>::value, boost::is_pointer<T>::value,
boost::is_void<T>::value,
&typeid(T),
&typeid(typename Bare_Type<T>::type));