Ignore:
Timestamp:
Sep 10, 2016, 12:53:36 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
908cc83
Parents:
add7117
Message:

major refactoring of Rodolfo's tuple assignment code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    radd7117 r5af62f1  
    142142                }
    143143
    144                 template< typename InputIterator, typename OutputIterator >
    145                 void findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {
    146                         AltList alternatives;
    147 
    148                         // select the alternatives that have the minimum parameter cost
    149                         Cost minCost = Cost::infinity;
    150                         for ( AltList::iterator i = begin; i != end; ++i ) {
    151                                 if ( i->cost < minCost ) {
    152                                         minCost = i->cost;
    153                                         i->cost = i->cvtCost;
    154                                         alternatives.clear();
    155                                         alternatives.push_back( *i );
    156                                 } else if ( i->cost == minCost ) {
    157                                         i->cost = i->cvtCost;
    158                                         alternatives.push_back( *i );
    159                                 }
    160                         }
    161                         std::copy( alternatives.begin(), alternatives.end(), out );
    162                 }
    163 
    164144                template< typename InputIterator >
    165145                void simpleCombineEnvironments( InputIterator begin, InputIterator end, TypeEnvironment &result ) {
     
    254234        template< typename StructOrUnionType >
    255235        void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
     236
     237                // // member must be either a tuple expression or a name expr
     238                // if ( NameExpr * nameExpr = dynamic_cast< NameExpr * >( memberExpr->get_member() ) ) {
     239                //  addAggMembers( structInst, agg->expr, agg->cost, nameExpr->get_name() );
     240                // } else {
     241                //  TupleExpr * tupleExpr = safe_dynamic_cast< TupleExpr * >( memberExpr->get_member() );
     242                //  // xxx - ...
     243                //  assert( false );
     244                // }
     245                // if ( TupleExpr * tupleExpr = dynamic_cast< TupleExpr * >( memberExpr->get_member() ) ) {
     246
     247                // }
    256248                NameExpr * nameExpr = safe_dynamic_cast< NameExpr * >( member );
    257249                const std::string & name = nameExpr->get_name();
     
    639631                combos( argAlternatives.begin(), argAlternatives.end(), back_inserter( possibilities ) );
    640632
    641                 Tuples::TupleAssignSpotter tassign( this );
    642                 if ( tassign.isTupleAssignment( untypedExpr, possibilities ) ) {
    643                         // take care of possible tuple assignments, or discard expression
    644                         return;
    645                 } // else ...
     633                // take care of possible tuple assignments
     634                // if not tuple assignment, assignment is taken care of as a normal function call
     635                Tuples::handleTupleAssignment( *this, untypedExpr, possibilities );
    646636
    647637                AltList candidates;
Note: See TracChangeset for help on using the changeset viewer.