Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    r4b7cce6 r2773ab8  
    957957                        }
    958958                };
    959         } // anonymous namespace
    960 
    961         /// Check if this expression is or includes a deleted expression
    962         const ast::DeletedExpr * findDeletedExpr( const ast::Expr * expr ) {
    963                 ast::Pass<DeleteFinder_new> finder;
    964                 expr->accept( finder );
    965                 return finder.pass.delExpr;
    966         }
    967 
    968         namespace {
     959
     960                /// Check if this expression is or includes a deleted expression
     961                const ast::DeletedExpr * findDeletedExpr( const ast::Expr * expr ) {
     962                        ast::Pass<DeleteFinder_new> finder;
     963                        expr->accept( finder );
     964                        return finder.pass.delExpr;
     965                }
     966
    969967                /// always-accept candidate filter
    970968                bool anyCandidate( const Candidate & ) { return true; }
     
    10261024
    10271025                        // promote candidate.cvtCost to .cost
    1028                         promoteCvtCost( winners );
     1026                        for ( CandidateRef & cand : winners ) {
     1027                                cand->cost = cand->cvtCost;
     1028                        }
    10291029
    10301030                        // produce ambiguous errors, if applicable
     
    11001100                        StripCasts_new::strip( expr );
    11011101                }
    1102         } // anonymous namespace
    1103 
    1104                
    1105         ast::ptr< ast::Expr > resolveInVoidContext(
    1106                 const ast::Expr * expr, const ast::SymbolTable & symtab, ast::TypeEnvironment & env
    1107         ) {
    1108                 assertf( expr, "expected a non-null expression" );
    1109                
    1110                 // set up and resolve expression cast to void
    1111                 ast::CastExpr * untyped = new ast::CastExpr{ expr->location, expr };
    1112                 CandidateRef choice = findUnfinishedKindExpression(
    1113                         untyped, symtab, "", anyCandidate, ResolvMode::withAdjustment() );
    1114                
    1115                 // a cast expression has either 0 or 1 interpretations (by language rules);
    1116                 // if 0, an exception has already been thrown, and this code will not run
    1117                 const ast::CastExpr * castExpr = choice->expr.strict_as< ast::CastExpr >();
    1118                 env = std::move( choice->env );
    1119 
    1120                 return castExpr->arg;
    1121         }
    1122 
    1123         namespace {
     1102
     1103                /// Find the expression candidate that is the unique best match for `untyped` in a `void`
     1104                /// context.
     1105                ast::ptr< ast::Expr > resolveInVoidContext(
     1106                        const ast::Expr * expr, const ast::SymbolTable & symtab, ast::TypeEnvironment & env
     1107                ) {
     1108                        assertf( expr, "expected a non-null expression" );
     1109                       
     1110                        // set up and resolve expression cast to void
     1111                        ast::CastExpr * untyped = new ast::CastExpr{ expr->location, expr };
     1112                        CandidateRef choice = findUnfinishedKindExpression(
     1113                                untyped, symtab, "", anyCandidate, ResolvMode::withAdjustment() );
     1114                       
     1115                        // a cast expression has either 0 or 1 interpretations (by language rules);
     1116                        // if 0, an exception has already been thrown, and this code will not run
     1117                        const ast::CastExpr * castExpr = choice->expr.strict_as< ast::CastExpr >();
     1118                        env = std::move( choice->env );
     1119
     1120                        return castExpr->arg;
     1121                }
     1122
    11241123                /// Resolve `untyped` to the expression whose candidate is the best match for a `void`
    11251124                /// context.
Note: See TracChangeset for help on using the changeset viewer.