Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    r954c954 r4ef08f7  
    188188
    189189                        // mark conversion cost and also specialization cost of param type
    190                         // const ast::Type * paramType = (*param)->get_type();
     190                        const ast::Type * paramType = (*param)->get_type();
    191191                        cand->expr = ast::mutate_field_index(
    192192                                appExpr, &ast::ApplicationExpr::args, i,
    193193                                computeExpressionConversionCost(
    194                                         args[i], *param, symtab, cand->env, convCost ) );
    195                         convCost.decSpec( specCost( *param ) );
     194                                        args[i], paramType, symtab, cand->env, convCost ) );
     195                        convCost.decSpec( specCost( paramType ) );
    196196                        ++param;  // can't be in for-loop update because of the continue
    197197                }
     
    698698                        if ( targetType && ! targetType->isVoid() && ! funcType->returns.empty() ) {
    699699                                // attempt to narrow based on expected target type
    700                                 const ast::Type * returnType = funcType->returns.front();
     700                                const ast::Type * returnType = funcType->returns.front()->get_type();
    701701                                if ( ! unify(
    702702                                        returnType, targetType, funcEnv, funcNeed, funcHave, funcOpen, symtab )
     
    712712                        std::size_t genStart = 0;
    713713
    714                         // xxx - how to handle default arg after change to ftype representation?
    715                         if (const ast::VariableExpr * varExpr = func->expr.as<ast::VariableExpr>()) {
    716                                 if (const ast::FunctionDecl * funcDecl = varExpr->var.as<ast::FunctionDecl>()) {
    717                                         // function may have default args only if directly calling by name
    718                                         // must use types on candidate however, due to RenameVars substitution
    719                                         auto nParams = funcType->params.size();
    720 
    721                                         for (size_t i=0; i<nParams; ++i) {
    722                                                 auto obj = funcDecl->params[i].strict_as<ast::ObjectDecl>();
    723                                                 if (!instantiateArgument(
    724                                                         funcType->params[i], obj->init, args, results, genStart, symtab)) return;
    725                                         }
    726                                         goto endMatch;
    727                                 }
    728                         }
    729                         for ( const auto & param : funcType->params ) {
     714                        for ( const ast::DeclWithType * param : funcType->params ) {
     715                                auto obj = strict_dynamic_cast< const ast::ObjectDecl * >( param );
    730716                                // Try adding the arguments corresponding to the current parameter to the existing
    731717                                // matches
    732                                 // no default args for indirect calls
    733718                                if ( ! instantiateArgument(
    734                                         param, nullptr, args, results, genStart, symtab ) ) return;
    735                         }
    736 
    737                         endMatch:
     719                                        obj->type, obj->init, args, results, genStart, symtab ) ) return;
     720                        }
     721
    738722                        if ( funcType->isVarArgs ) {
    739723                                // append any unused arguments to vararg pack
     
    832816                /// Adds aggregate member interpretations
    833817                void addAggMembers(
    834                         const ast::BaseInstType * aggrInst, const ast::Expr * expr,
     818                        const ast::ReferenceToType * aggrInst, const ast::Expr * expr,
    835819                        const Candidate & cand, const Cost & addedCost, const std::string & name
    836820                ) {
     
    12791263
    12801264                void postvisit( const ast::UntypedOffsetofExpr * offsetofExpr ) {
    1281                         const ast::BaseInstType * aggInst;
     1265                        const ast::ReferenceToType * aggInst;
    12821266                        if (( aggInst = offsetofExpr->type.as< ast::StructInstType >() )) ;
    12831267                        else if (( aggInst = offsetofExpr->type.as< ast::UnionInstType >() )) ;
Note: See TracChangeset for help on using the changeset viewer.