Ignore:
Timestamp:
Oct 5, 2018, 10:30:21 AM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
6d6e829
Parents:
9ad2f9f
Message:

Switch resolution flags to packed struct

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    r9ad2f9f r59cf83b  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sat May 16 23:52:08 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Feb 17 11:19:39 2018
    13 // Update Count     : 33
     11// Last Modified By : Aaron B. Moss
     12// Last Modified On : Fri Oct -5 10:01:00 2018
     13// Update Count     : 34
    1414//
    1515
     
    244244        }
    245245
    246         void AlternativeFinder::find( Expression *expr, bool adjust, bool prune, bool failFast ) {
     246        void AlternativeFinder::find( Expression *expr, ResolvMode mode ) {
    247247                PassVisitor<Finder> finder( *this );
    248248                expr->accept( finder );
    249                 if ( failFast && alternatives.empty() ) {
     249                if ( mode.failFast && alternatives.empty() ) {
    250250                        PRINT(
    251251                                std::cerr << "No reasonable alternatives for expression " << expr << std::endl;
     
    253253                        SemanticError( expr, "No reasonable alternatives for expression " );
    254254                }
    255                 if ( prune ) {
     255                if ( mode.prune ) {
    256256                        auto oldsize = alternatives.size();
    257257                        PRINT(
     
    261261                        AltList pruned;
    262262                        pruneAlternatives( alternatives.begin(), alternatives.end(), back_inserter( pruned ) );
    263                         if ( failFast && pruned.empty() ) {
     263                        if ( mode.failFast && pruned.empty() ) {
    264264                                std::ostringstream stream;
    265265                                AltList winners;
     
    280280                }
    281281                // adjust types after pruning so that types substituted by pruneAlternatives are correctly adjusted
    282                 for ( AltList::iterator i = alternatives.begin(); i != alternatives.end(); ++i ) {
    283                         if ( adjust ) {
    284                                 adjustExprType( i->expr->get_result(), i->env, indexer );
     282                if ( mode.adjust ) {
     283                        for ( Alternative& i : alternatives ) {
     284                                adjustExprType( i.expr->get_result(), i.env, indexer );
    285285                        }
    286286                }
     
    294294
    295295        void AlternativeFinder::findWithAdjustment( Expression *expr ) {
    296                 find( expr, true );
     296                find( expr, ResolvMode::withAdjustment() );
    297297        }
    298298
    299299        void AlternativeFinder::findWithoutPrune( Expression * expr ) {
    300                 find( expr, true, false );
     300                find( expr, ResolvMode::withoutPrune() );
    301301        }
    302302
    303303        void AlternativeFinder::maybeFind( Expression * expr ) {
    304                 find( expr, true, true, false );
     304                find( expr, ResolvMode::withoutFailFast() );
    305305        }
    306306
Note: See TracChangeset for help on using the changeset viewer.