interrogate: do not wrap methods with rvalue arguments

This could in theory be supported, but this is not really intuitive from a Python user's point of view.
This commit is contained in:
rdb 2018-06-30 17:34:54 +02:00
parent e191ee84f4
commit 9441c28f61
3 changed files with 25 additions and 0 deletions

View File

@ -7298,6 +7298,10 @@ is_cpp_type_legal(CPPType *in_ctype) {
// bool answer = false;
CPPType *type = TypeManager::resolve_type(in_ctype);
if (TypeManager::is_rvalue_reference(type)) {
return false;
}
type = TypeManager::unwrap(type);
if (TypeManager::is_void(type)) {

View File

@ -124,6 +124,26 @@ is_reference(CPPType *type) {
}
}
/**
* Returns true if the indicated type is some kind of an rvalue reference.
*/
bool TypeManager::
is_rvalue_reference(CPPType *type) {
switch (type->get_subtype()) {
case CPPDeclaration::ST_const:
return is_rvalue_reference(type->as_const_type()->_wrapped_around);
case CPPDeclaration::ST_reference:
return type->as_reference_type()->_value_category == CPPReferenceType::VC_rvalue;
case CPPDeclaration::ST_typedef:
return is_rvalue_reference(type->as_typedef_type()->_type);
default:
return false;
}
}
/**
* Returns true if the indicated type is some kind of a reference or const
* reference type at all, false otherwise.

View File

@ -44,6 +44,7 @@ public:
static bool is_assignable(CPPType *type);
static bool is_reference(CPPType *type);
static bool is_rvalue_reference(CPPType *type);
static bool is_ref_to_anything(CPPType *type);
static bool is_const_ref_to_anything(CPPType *type);
static bool is_const_pointer_to_anything(CPPType *type);