Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    rb69233ac r17a0ede2  
    6666UniqueId globalResnSlot = 0;
    6767
    68 Cost computeConversionCost(
    69         const ast::Type * argType, const ast::Type * paramType, const ast::SymbolTable & symtab,
    70         const ast::TypeEnvironment & env
    71 ) {
    72         PRINT(
    73                 std::cerr << std::endl << "converting ";
    74                 ast::print( std::cerr, argType, 2 );
    75                 std::cerr << std::endl << " to ";
    76                 ast::print( std::cerr, paramType, 2 );
    77                 std::cerr << std::endl << "environment is: ";
    78                 ast::print( std::cerr, env, 2 );
    79                 std::cerr << std::endl;
    80         )
    81         Cost convCost = conversionCost( argType, paramType, symtab, env );
    82         PRINT(
    83                 std::cerr << std::endl << "cost is " << convCost << std::endl;
    84         )
    85         if ( convCost == Cost::infinity ) return convCost;
    86         convCost.incPoly( polyCost( paramType, symtab, env ) + polyCost( argType, symtab, env ) );
    87         PRINT(
    88                 std::cerr << "cost with polycost is " << convCost << std::endl;
    89         )
    90         return convCost;
    91 }
    92 
    9368namespace {
    9469        /// First index is which argument, second is which alternative, third is which exploded element
     
    10984                }
    11085                return out;
     86        }
     87
     88        /// Computes conversion cost between two types
     89        Cost computeConversionCost(
     90                const ast::Type * argType, const ast::Type * paramType, const ast::SymbolTable & symtab,
     91                const ast::TypeEnvironment & env
     92        ) {
     93                PRINT(
     94                        std::cerr << std::endl << "converting ";
     95                        ast::print( std::cerr, argType, 2 );
     96                        std::cerr << std::endl << " to ";
     97                        ast::print( std::cerr, paramType, 2 );
     98                        std::cerr << std::endl << "environment is: ";
     99                        ast::print( std::cerr, env, 2 );
     100                        std::cerr << std::endl;
     101                )
     102                Cost convCost = conversionCost( argType, paramType, symtab, env );
     103                PRINT(
     104                        std::cerr << std::endl << "cost is " << convCost << std::endl;
     105                )
     106                if ( convCost == Cost::infinity ) return convCost;
     107                convCost.incPoly( polyCost( paramType, symtab, env ) + polyCost( argType, symtab, env ) );
     108                PRINT(
     109                        std::cerr << "cost with polycost is " << convCost << std::endl;
     110                )
     111                return convCost;
    111112        }
    112113
     
    15631564                CandidateList satisfied;
    15641565                std::vector< std::string > errors;
    1565                 for ( CandidateRef & candidate : candidates ) {
    1566                         satisfyAssertions( candidate, symtab, satisfied, errors );
     1566                for ( auto & candidate : candidates ) {
     1567                        satisfyAssertions( *candidate, symtab, satisfied, errors );
    15671568                }
    15681569
Note: See TracChangeset for help on using the changeset viewer.