Ignore:
Timestamp:
Nov 30, 2023, 2:41:11 PM (7 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
d787828d
Parents:
83fd57d
Message:

Renamed ResolvMode? to ResolveMode?. This is less consistent with the namespace, but is more consistent with almost everything else.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    r83fd57d r4a89b52  
    105105
    106106                        // CandidateFinder finder{ symtab, env };
    107                         // finder.find( arg, ResolvMode::withAdjustment() );
     107                        // finder.find( arg, ResolveMode::withAdjustment() );
    108108                        // assertf( finder.candidates.size() > 0,
    109109                        //      "Somehow castable expression failed to find alternatives." );
     
    974974                // xxx - is it possible that handleTupleAssignment and main finder both produce candidates?
    975975                // this means there exists ctor/assign functions with a tuple as first parameter.
    976                 ResolvMode mode = {
     976                ResolveMode mode = {
    977977                        true, // adjust
    978978                        !untypedExpr->func.as<ast::NameExpr>(), // prune if not calling by name
     
    989989                CandidateFinder opFinder( context, tenv );
    990990                // okay if there aren't any function operations
    991                 opFinder.find( opExpr, ResolvMode::withoutFailFast() );
     991                opFinder.find( opExpr, ResolveMode::withoutFailFast() );
    992992                PRINT(
    993993                        std::cerr << "known function ops:" << std::endl;
     
    11751175                if ( castExpr->kind == ast::CastExpr::Return ) {
    11761176                        finder.strictMode = true;
    1177                         finder.find( castExpr->arg, ResolvMode::withAdjustment() );
     1177                        finder.find( castExpr->arg, ResolveMode::withAdjustment() );
    11781178
    11791179                        // return casts are eliminated (merely selecting an overload, no actual operation)
    11801180                        candidates = std::move(finder.candidates);
    11811181                }
    1182                 finder.find( castExpr->arg, ResolvMode::withAdjustment() );
     1182                finder.find( castExpr->arg, ResolveMode::withAdjustment() );
    11831183
    11841184                if ( !finder.candidates.empty() ) reason.code = NoMatch;
     
    12511251                CandidateFinder finder( context, tenv );
    12521252                // don't prune here, all alternatives guaranteed to have same type
    1253                 finder.find( castExpr->arg, ResolvMode::withoutPrune() );
     1253                finder.find( castExpr->arg, ResolveMode::withoutPrune() );
    12541254                for ( CandidateRef & r : finder.candidates ) {
    12551255                        addCandidate(
     
    12981298
    12991299                        // don't prune here, since it's guaranteed all alternatives will have the same type
    1300                         finder.find( tech1.get(), ResolvMode::withoutPrune() );
     1300                        finder.find( tech1.get(), ResolveMode::withoutPrune() );
    13011301                        pick_alternatives(finder.candidates, false);
    13021302
     
    13071307                std::unique_ptr<const ast::Expr> fallback { ast::UntypedExpr::createDeref(loc,  new ast::UntypedExpr(loc, new ast::NameExpr(loc, castExpr->concrete_target.getter), { castExpr->arg })) };
    13081308                // don't prune here, since it's guaranteed all alternatives will have the same type
    1309                 finder.find( fallback.get(), ResolvMode::withoutPrune() );
     1309                finder.find( fallback.get(), ResolveMode::withoutPrune() );
    13101310
    13111311                pick_alternatives(finder.candidates, true);
     
    13161316        void Finder::postvisit( const ast::UntypedMemberExpr * memberExpr ) {
    13171317                CandidateFinder aggFinder( context, tenv );
    1318                 aggFinder.find( memberExpr->aggregate, ResolvMode::withAdjustment() );
     1318                aggFinder.find( memberExpr->aggregate, ResolveMode::withAdjustment() );
    13191319                for ( CandidateRef & agg : aggFinder.candidates ) {
    13201320                        // it's okay for the aggregate expression to have reference type -- cast it to the
     
    14751475        void Finder::postvisit( const ast::LogicalExpr * logicalExpr ) {
    14761476                CandidateFinder finder1( context, tenv );
    1477                 finder1.find( logicalExpr->arg1, ResolvMode::withAdjustment() );
     1477                finder1.find( logicalExpr->arg1, ResolveMode::withAdjustment() );
    14781478                if ( finder1.candidates.empty() ) return;
    14791479
    14801480                CandidateFinder finder2( context, tenv );
    1481                 finder2.find( logicalExpr->arg2, ResolvMode::withAdjustment() );
     1481                finder2.find( logicalExpr->arg2, ResolveMode::withAdjustment() );
    14821482                if ( finder2.candidates.empty() ) return;
    14831483
     
    15051505                // candidates for condition
    15061506                CandidateFinder finder1( context, tenv );
    1507                 finder1.find( conditionalExpr->arg1, ResolvMode::withAdjustment() );
     1507                finder1.find( conditionalExpr->arg1, ResolveMode::withAdjustment() );
    15081508                if ( finder1.candidates.empty() ) return;
    15091509
     
    15111511                CandidateFinder finder2( context, tenv );
    15121512                finder2.allowVoid = true;
    1513                 finder2.find( conditionalExpr->arg2, ResolvMode::withAdjustment() );
     1513                finder2.find( conditionalExpr->arg2, ResolveMode::withAdjustment() );
    15141514                if ( finder2.candidates.empty() ) return;
    15151515
     
    15171517                CandidateFinder finder3( context, tenv );
    15181518                finder3.allowVoid = true;
    1519                 finder3.find( conditionalExpr->arg3, ResolvMode::withAdjustment() );
     1519                finder3.find( conditionalExpr->arg3, ResolveMode::withAdjustment() );
    15201520                if ( finder3.candidates.empty() ) return;
    15211521
     
    15701570
    15711571                CandidateFinder finder2( context, env );
    1572                 finder2.find( commaExpr->arg2, ResolvMode::withAdjustment() );
     1572                finder2.find( commaExpr->arg2, ResolveMode::withAdjustment() );
    15731573
    15741574                for ( const CandidateRef & r2 : finder2.candidates ) {
     
    15841584                CandidateFinder finder( context, tenv );
    15851585                finder.allowVoid = true;
    1586                 finder.find( ctorExpr->callExpr, ResolvMode::withoutPrune() );
     1586                finder.find( ctorExpr->callExpr, ResolveMode::withoutPrune() );
    15871587                for ( CandidateRef & r : finder.candidates ) {
    15881588                        addCandidate( *r, new ast::ConstructorExpr{ ctorExpr->location, r->expr } );
     
    15931593                // resolve low and high, accept candidates where low and high types unify
    15941594                CandidateFinder finder1( context, tenv );
    1595                 finder1.find( rangeExpr->low, ResolvMode::withAdjustment() );
     1595                finder1.find( rangeExpr->low, ResolveMode::withAdjustment() );
    15961596                if ( finder1.candidates.empty() ) return;
    15971597
    15981598                CandidateFinder finder2( context, tenv );
    1599                 finder2.find( rangeExpr->high, ResolvMode::withAdjustment() );
     1599                finder2.find( rangeExpr->high, ResolveMode::withAdjustment() );
    16001600                if ( finder2.candidates.empty() ) return;
    16011601
     
    16731673        void Finder::postvisit( const ast::UniqueExpr * unqExpr ) {
    16741674                CandidateFinder finder( context, tenv );
    1675                 finder.find( unqExpr->expr, ResolvMode::withAdjustment() );
     1675                finder.find( unqExpr->expr, ResolveMode::withAdjustment() );
    16761676                for ( CandidateRef & r : finder.candidates ) {
    16771677                        // ensure that the the id is passed on so that the expressions are "linked"
     
    16991699                        // only open for the duration of resolving the UntypedExpr.
    17001700                        CandidateFinder finder( context, tenv, toType );
    1701                         finder.find( initExpr->expr, ResolvMode::withAdjustment() );
     1701                        finder.find( initExpr->expr, ResolveMode::withAdjustment() );
    17021702
    17031703                        Cost minExprCost = Cost::infinity;
     
    18891889}
    18901890
    1891 void CandidateFinder::find( const ast::Expr * expr, ResolvMode mode ) {
     1891void CandidateFinder::find( const ast::Expr * expr, ResolveMode mode ) {
    18921892        // Find alternatives for expression
    18931893        ast::Pass<Finder> finder{ *this };
     
    20042004        for ( const auto & x : xs ) {
    20052005                out.emplace_back( context, env );
    2006                 out.back().find( x, ResolvMode::withAdjustment() );
     2006                out.back().find( x, ResolveMode::withAdjustment() );
    20072007
    20082008                PRINT(
Note: See TracChangeset for help on using the changeset viewer.