std::string UniOpQueryDesc( UniOpType type, ExprType const &thisExprType ) { return "unary operator " + uniOpUserName( type ) + DescParams( ExprTypeVector( thisExprType ) ); }
std::string UniOpFullDesc( RC::ConstHandle<Adapter> const &returnAdapter, UniOpType type, ExprType const &thisExprType ) { std::string result = "function "; if ( returnAdapter ) result += returnAdapter->getUserName() + " "; result += uniOpUserName( type ) + DescParams( ExprTypeVector( thisExprType ) ); return result; }
bool Function::isImplicitCastMatch( ExprTypeVector const &argTypes, ModuleBuilder const &moduleBuilder, size_t &maxCost ) const { if ( argTypes.size() != m_params.size() ) return false; maxCost = 0; size_t numExactTypeMatch = 0; for ( size_t i=0; i<argTypes.size(); ++i ) { Usage argUsage = argTypes[i].getUsage(), paramUsage = m_params[i].getUsage(); RC::ConstHandle<Adapter> argAdapter = argTypes[i].getAdapter(), paramAdapter = m_params[i].getAdapter(); if ( argUsage == paramUsage && argAdapter->isEquivalentTo( paramAdapter ) ) { ++numExactTypeMatch; continue; } if ( paramUsage == USAGE_RVALUE ) { if ( argUsage == USAGE_LVALUE && argAdapter->isEquivalentTo( paramAdapter ) ) { ++numExactTypeMatch; continue; } Function const *function = moduleBuilder.maybeGetPreciseFunction( ConstructorPencilKey( paramAdapter ), ExprTypeVector( ExprType( paramAdapter, USAGE_LVALUE ), ExprType( argAdapter, USAGE_RVALUE ) ) ); if ( function ) { maxCost += function->getPolymorphismParameters()->cost; continue; } } return false; } return numExactTypeMatch >= getPolymorphismParameters()->minExactTypeMatch; }