Ignore:
Timestamp:
Jan 30, 2018, 3:54:32 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, 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:
633a642
Parents:
f792cb8 (diff), 42be3c3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    rf792cb8 r7416d46a  
    6060
    6161namespace ResolvExpr {
     62        struct AlternativeFinder::Finder : public WithShortCircuiting {
     63                Finder( AlternativeFinder & altFinder ) : altFinder( altFinder ), indexer( altFinder.indexer ), alternatives( altFinder.alternatives ), env( altFinder.env ), targetType( altFinder.targetType )  {}
     64
     65                void previsit( BaseSyntaxNode * ) { visit_children = false; }
     66
     67                void postvisit( ApplicationExpr * applicationExpr );
     68                void postvisit( UntypedExpr * untypedExpr );
     69                void postvisit( AddressExpr * addressExpr );
     70                void postvisit( LabelAddressExpr * labelExpr );
     71                void postvisit( CastExpr * castExpr );
     72                void postvisit( VirtualCastExpr * castExpr );
     73                void postvisit( UntypedMemberExpr * memberExpr );
     74                void postvisit( MemberExpr * memberExpr );
     75                void postvisit( NameExpr * variableExpr );
     76                void postvisit( VariableExpr * variableExpr );
     77                void postvisit( ConstantExpr * constantExpr );
     78                void postvisit( SizeofExpr * sizeofExpr );
     79                void postvisit( AlignofExpr * alignofExpr );
     80                void postvisit( UntypedOffsetofExpr * offsetofExpr );
     81                void postvisit( OffsetofExpr * offsetofExpr );
     82                void postvisit( OffsetPackExpr * offsetPackExpr );
     83                void postvisit( AttrExpr * attrExpr );
     84                void postvisit( LogicalExpr * logicalExpr );
     85                void postvisit( ConditionalExpr * conditionalExpr );
     86                void postvisit( CommaExpr * commaExpr );
     87                void postvisit( ImplicitCopyCtorExpr  * impCpCtorExpr );
     88                void postvisit( ConstructorExpr  * ctorExpr );
     89                void postvisit( RangeExpr  * rangeExpr );
     90                void postvisit( UntypedTupleExpr * tupleExpr );
     91                void postvisit( TupleExpr * tupleExpr );
     92                void postvisit( TupleIndexExpr * tupleExpr );
     93                void postvisit( TupleAssignExpr * tupleExpr );
     94                void postvisit( UniqueExpr * unqExpr );
     95                void postvisit( StmtExpr * stmtExpr );
     96                void postvisit( UntypedInitExpr * initExpr );
     97
     98                /// Adds alternatives for anonymous members
     99                void addAnonConversions( const Alternative & alt );
     100                /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member
     101                template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
     102                /// Adds alternatives for member expressions where the left side has tuple type
     103                void addTupleMembers( TupleType * tupleType, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
     104                /// Adds alternatives for offsetof expressions, given the base type and name of the member
     105                template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name );
     106                /// Takes a final result and checks if its assertions can be satisfied
     107                template<typename OutputIterator>
     108                void validateFunctionAlternative( const Alternative &func, ArgPack& result, const std::vector<ArgPack>& results, OutputIterator out );
     109                /// Finds matching alternatives for a function, given a set of arguments
     110                template<typename OutputIterator>
     111                void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const ExplodedArgs& args, OutputIterator out );
     112                /// Checks if assertion parameters match for a new alternative
     113                template< typename OutputIterator >
     114                void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out );
     115        private:
     116                AlternativeFinder & altFinder;
     117                const SymTab::Indexer &indexer;
     118                AltList & alternatives;
     119                const TypeEnvironment &env;
     120                Type *& targetType;
     121        };
     122
    62123        Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env ) {
    63124                CastExpr *castToVoid = new CastExpr( expr );
     
    152213
    153214                void renameTypes( Expression *expr ) {
    154                         expr->get_result()->accept( global_renamer );
     215                        renameTyVars( expr->result );
    155216                }
    156217        } // namespace
     
    185246
    186247        void AlternativeFinder::find( Expression *expr, bool adjust, bool prune, bool failFast ) {
    187                 expr->accept( *this );
     248                PassVisitor<Finder> finder( *this );
     249                expr->accept( finder );
    188250                if ( failFast && alternatives.empty() ) {
    189251                        PRINT(
     
    244306        }
    245307
    246         void AlternativeFinder::addAnonConversions( const Alternative & alt ) {
     308        void AlternativeFinder::Finder::addAnonConversions( const Alternative & alt ) {
    247309                // adds anonymous member interpretations whenever an aggregate value type is seen.
    248310                // it's okay for the aggregate expression to have reference type -- cast it to the base type to treat the aggregate as the referenced value
     
    265327
    266328        template< typename StructOrUnionType >
    267         void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
     329        void AlternativeFinder::Finder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
    268330                // by this point, member must be a name expr
    269331                NameExpr * nameExpr = dynamic_cast< NameExpr * >( member );
     
    284346        }
    285347
    286         void AlternativeFinder::addTupleMembers( TupleType * tupleType, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
     348        void AlternativeFinder::Finder::addTupleMembers( TupleType * tupleType, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
    287349                if ( ConstantExpr * constantExpr = dynamic_cast< ConstantExpr * >( member ) ) {
    288350                        // get the value of the constant expression as an int, must be between 0 and the length of the tuple type to have meaning
     
    308370        }
    309371
    310         void AlternativeFinder::visit( ApplicationExpr *applicationExpr ) {
     372        void AlternativeFinder::Finder::postvisit( ApplicationExpr *applicationExpr ) {
    311373                alternatives.push_back( Alternative( applicationExpr->clone(), env, Cost::zero ) );
    312374        }
     
    485547                        Type *adjType = candidate->get_type()->clone();
    486548                        adjustExprType( adjType, newEnv, indexer );
    487                         adjType->accept( global_renamer );
     549                        renameTyVars( adjType );
    488550                        PRINT(
    489551                                std::cerr << "unifying ";
     
    541603
    542604        template< typename OutputIterator >
    543         void AlternativeFinder::inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out ) {
     605        void AlternativeFinder::Finder::inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out ) {
    544606//      PRINT(
    545607//          std::cerr << "inferParameters: assertions needed are" << std::endl;
     
    595657
    596658                ArgPack()
    597                         : parent(0), expr(), cost(Cost::zero), env(), need(), have(), openVars(), nextArg(0), 
     659                        : parent(0), expr(), cost(Cost::zero), env(), need(), have(), openVars(), nextArg(0),
    598660                          tupleStart(0), nextExpl(0), explAlt(0) {}
    599661
     
    706768
    707769                                                if ( nTuples > 0 || ! results[i].expr ) {
    708                                                         // first iteration or no expression to clone, 
     770                                                        // first iteration or no expression to clone,
    709771                                                        // push empty tuple expression
    710772                                                        newResult.parent = i;
     
    892954
    893955        template<typename OutputIterator>
    894         void AlternativeFinder::validateFunctionAlternative( const Alternative &func, ArgPack& result,
     956        void AlternativeFinder::Finder::validateFunctionAlternative( const Alternative &func, ArgPack& result,
    895957                        const std::vector<ArgPack>& results, OutputIterator out ) {
    896958                ApplicationExpr *appExpr = new ApplicationExpr( func.expr->clone() );
     
    915977
    916978        template<typename OutputIterator>
    917         void AlternativeFinder::makeFunctionAlternatives( const Alternative &func,
     979        void AlternativeFinder::Finder::makeFunctionAlternatives( const Alternative &func,
    918980                        FunctionType *funcType, const ExplodedArgs &args, OutputIterator out ) {
    919981                OpenVarSet funcOpenVars;
     
    10221084        }
    10231085
    1024         void AlternativeFinder::visit( UntypedExpr *untypedExpr ) {
     1086        void AlternativeFinder::Finder::postvisit( UntypedExpr *untypedExpr ) {
    10251087                AlternativeFinder funcFinder( indexer, env );
    10261088                funcFinder.findWithAdjustment( untypedExpr->get_function() );
     
    10291091
    10301092                std::vector< AlternativeFinder > argAlternatives;
    1031                 findSubExprs( untypedExpr->begin_args(), untypedExpr->end_args(),
     1093                altFinder.findSubExprs( untypedExpr->begin_args(), untypedExpr->end_args(),
    10321094                        back_inserter( argAlternatives ) );
    10331095
    10341096                // take care of possible tuple assignments
    10351097                // if not tuple assignment, assignment is taken care of as a normal function call
    1036                 Tuples::handleTupleAssignment( *this, untypedExpr, argAlternatives );
     1098                Tuples::handleTupleAssignment( altFinder, untypedExpr, argAlternatives );
    10371099
    10381100                // find function operators
     
    11721234                        // fix this issue in a more robust way.
    11731235                        targetType = nullptr;
    1174                         visit( untypedExpr );
     1236                        postvisit( untypedExpr );
    11751237                }
    11761238        }
     
    11811243        }
    11821244
    1183         void AlternativeFinder::visit( AddressExpr *addressExpr ) {
     1245        void AlternativeFinder::Finder::postvisit( AddressExpr *addressExpr ) {
    11841246                AlternativeFinder finder( indexer, env );
    11851247                finder.find( addressExpr->get_arg() );
     
    11921254        }
    11931255
    1194         void AlternativeFinder::visit( LabelAddressExpr * expr ) {
     1256        void AlternativeFinder::Finder::postvisit( LabelAddressExpr * expr ) {
    11951257                alternatives.push_back( Alternative{ expr->clone(), env, Cost::zero } );
    11961258        }
     
    12231285        }
    12241286
    1225         void AlternativeFinder::visit( CastExpr *castExpr ) {
     1287        void AlternativeFinder::Finder::postvisit( CastExpr *castExpr ) {
    12261288                Type *& toType = castExpr->get_result();
    12271289                assert( toType );
     
    12781340        }
    12791341
    1280         void AlternativeFinder::visit( VirtualCastExpr * castExpr ) {
     1342        void AlternativeFinder::Finder::postvisit( VirtualCastExpr * castExpr ) {
    12811343                assertf( castExpr->get_result(), "Implicate virtual cast targets not yet supported." );
    12821344                AlternativeFinder finder( indexer, env );
     
    12901352        }
    12911353
    1292         void AlternativeFinder::visit( UntypedMemberExpr *memberExpr ) {
     1354        void AlternativeFinder::Finder::postvisit( UntypedMemberExpr *memberExpr ) {
    12931355                AlternativeFinder funcFinder( indexer, env );
    12941356                funcFinder.findWithAdjustment( memberExpr->get_aggregate() );
     
    13121374        }
    13131375
    1314         void AlternativeFinder::visit( MemberExpr *memberExpr ) {
     1376        void AlternativeFinder::Finder::postvisit( MemberExpr *memberExpr ) {
    13151377                alternatives.push_back( Alternative( memberExpr->clone(), env, Cost::zero ) );
    13161378        }
    13171379
    1318         void AlternativeFinder::visit( NameExpr *nameExpr ) {
     1380        void AlternativeFinder::Finder::postvisit( NameExpr *nameExpr ) {
    13191381                std::list< SymTab::Indexer::IdData > declList;
    13201382                indexer.lookupId( nameExpr->get_name(), declList );
     
    13371399        }
    13381400
    1339         void AlternativeFinder::visit( VariableExpr *variableExpr ) {
     1401        void AlternativeFinder::Finder::postvisit( VariableExpr *variableExpr ) {
    13401402                // not sufficient to clone here, because variable's type may have changed
    13411403                // since the VariableExpr was originally created.
     
    13431405        }
    13441406
    1345         void AlternativeFinder::visit( ConstantExpr *constantExpr ) {
     1407        void AlternativeFinder::Finder::postvisit( ConstantExpr *constantExpr ) {
    13461408                alternatives.push_back( Alternative( constantExpr->clone(), env, Cost::zero ) );
    13471409        }
    13481410
    1349         void AlternativeFinder::visit( SizeofExpr *sizeofExpr ) {
     1411        void AlternativeFinder::Finder::postvisit( SizeofExpr *sizeofExpr ) {
    13501412                if ( sizeofExpr->get_isType() ) {
    13511413                        Type * newType = sizeofExpr->get_type()->clone();
     
    13681430        }
    13691431
    1370         void AlternativeFinder::visit( AlignofExpr *alignofExpr ) {
     1432        void AlternativeFinder::Finder::postvisit( AlignofExpr *alignofExpr ) {
    13711433                if ( alignofExpr->get_isType() ) {
    13721434                        Type * newType = alignofExpr->get_type()->clone();
     
    13901452
    13911453        template< typename StructOrUnionType >
    1392         void AlternativeFinder::addOffsetof( StructOrUnionType *aggInst, const std::string &name ) {
     1454        void AlternativeFinder::Finder::addOffsetof( StructOrUnionType *aggInst, const std::string &name ) {
    13931455                std::list< Declaration* > members;
    13941456                aggInst->lookup( name, members );
     
    14031465        }
    14041466
    1405         void AlternativeFinder::visit( UntypedOffsetofExpr *offsetofExpr ) {
     1467        void AlternativeFinder::Finder::postvisit( UntypedOffsetofExpr *offsetofExpr ) {
    14061468                AlternativeFinder funcFinder( indexer, env );
    14071469                // xxx - resolveTypeof?
     
    14131475        }
    14141476
    1415         void AlternativeFinder::visit( OffsetofExpr *offsetofExpr ) {
     1477        void AlternativeFinder::Finder::postvisit( OffsetofExpr *offsetofExpr ) {
    14161478                alternatives.push_back( Alternative( offsetofExpr->clone(), env, Cost::zero ) );
    14171479        }
    14181480
    1419         void AlternativeFinder::visit( OffsetPackExpr *offsetPackExpr ) {
     1481        void AlternativeFinder::Finder::postvisit( OffsetPackExpr *offsetPackExpr ) {
    14201482                alternatives.push_back( Alternative( offsetPackExpr->clone(), env, Cost::zero ) );
    14211483        }
     
    14441506        }
    14451507
    1446         void AlternativeFinder::visit( AttrExpr *attrExpr ) {
     1508        void AlternativeFinder::Finder::postvisit( AttrExpr *attrExpr ) {
    14471509                // assume no 'pointer-to-attribute'
    14481510                NameExpr *nameExpr = dynamic_cast< NameExpr* >( attrExpr->get_attr() );
     
    14581520                                        if ( function->get_parameters().size() == 1 ) {
    14591521                                                if ( attrExpr->get_isType() ) {
    1460                                                         resolveAttr( data, function, attrExpr->get_type(), env, *this );
     1522                                                        resolveAttr( data, function, attrExpr->get_type(), env, altFinder);
    14611523                                                } else {
    14621524                                                        AlternativeFinder finder( indexer, env );
     
    14641526                                                        for ( AltList::iterator choice = finder.alternatives.begin(); choice != finder.alternatives.end(); ++choice ) {
    14651527                                                                if ( choice->expr->get_result()->size() == 1 ) {
    1466                                                                         resolveAttr(data, function, choice->expr->get_result(), choice->env, *this );
     1528                                                                        resolveAttr(data, function, choice->expr->get_result(), choice->env, altFinder );
    14671529                                                                } // fi
    14681530                                                        } // for
     
    14791541        }
    14801542
    1481         void AlternativeFinder::visit( LogicalExpr *logicalExpr ) {
     1543        void AlternativeFinder::Finder::postvisit( LogicalExpr *logicalExpr ) {
    14821544                AlternativeFinder firstFinder( indexer, env );
    14831545                firstFinder.findWithAdjustment( logicalExpr->get_arg1() );
     1546                if ( firstFinder.alternatives.empty() ) return;
     1547                AlternativeFinder secondFinder( indexer, env );
     1548                secondFinder.findWithAdjustment( logicalExpr->get_arg2() );
     1549                if ( secondFinder.alternatives.empty() ) return;
    14841550                for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) {
    1485                         AlternativeFinder secondFinder( indexer, first->env );
    1486                         secondFinder.findWithAdjustment( logicalExpr->get_arg2() );
    14871551                        for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) {
     1552                                TypeEnvironment compositeEnv;
     1553                                compositeEnv.simpleCombine( first->env );
     1554                                compositeEnv.simpleCombine( second->env );
     1555
    14881556                                LogicalExpr *newExpr = new LogicalExpr( first->expr->clone(), second->expr->clone(), logicalExpr->get_isAnd() );
    1489                                 alternatives.push_back( Alternative( newExpr, second->env, first->cost + second->cost ) );
    1490                         }
    1491                 }
    1492         }
    1493 
    1494         void AlternativeFinder::visit( ConditionalExpr *conditionalExpr ) {
     1557                                alternatives.push_back( Alternative( newExpr, compositeEnv, first->cost + second->cost ) );
     1558                        }
     1559                }
     1560        }
     1561
     1562        void AlternativeFinder::Finder::postvisit( ConditionalExpr *conditionalExpr ) {
    14951563                // find alternatives for condition
    14961564                AlternativeFinder firstFinder( indexer, env );
    14971565                firstFinder.findWithAdjustment( conditionalExpr->get_arg1() );
     1566                if ( firstFinder.alternatives.empty() ) return;
     1567                // find alternatives for true expression
     1568                AlternativeFinder secondFinder( indexer, env );
     1569                secondFinder.findWithAdjustment( conditionalExpr->get_arg2() );
     1570                if ( secondFinder.alternatives.empty() ) return;
     1571                // find alterantives for false expression
     1572                AlternativeFinder thirdFinder( indexer, env );
     1573                thirdFinder.findWithAdjustment( conditionalExpr->get_arg3() );
     1574                if ( thirdFinder.alternatives.empty() ) return;
    14981575                for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) {
    1499                         // find alternatives for true expression
    1500                         AlternativeFinder secondFinder( indexer, first->env );
    1501                         secondFinder.findWithAdjustment( conditionalExpr->get_arg2() );
    15021576                        for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) {
    1503                                 // find alterantives for false expression
    1504                                 AlternativeFinder thirdFinder( indexer, second->env );
    1505                                 thirdFinder.findWithAdjustment( conditionalExpr->get_arg3() );
    15061577                                for ( AltList::const_iterator third = thirdFinder.alternatives.begin(); third != thirdFinder.alternatives.end(); ++third ) {
     1578                                        TypeEnvironment compositeEnv;
     1579                                        compositeEnv.simpleCombine( first->env );
     1580                                        compositeEnv.simpleCombine( second->env );
     1581                                        compositeEnv.simpleCombine( third->env );
     1582
    15071583                                        // unify true and false types, then infer parameters to produce new alternatives
    15081584                                        OpenVarSet openVars;
    15091585                                        AssertionSet needAssertions, haveAssertions;
    1510                                         Alternative newAlt( 0, third->env, first->cost + second->cost + third->cost );
     1586                                        Alternative newAlt( 0, compositeEnv, first->cost + second->cost + third->cost );
    15111587                                        Type* commonType = nullptr;
    15121588                                        if ( unify( second->expr->get_result(), third->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
     
    15241600        }
    15251601
    1526         void AlternativeFinder::visit( CommaExpr *commaExpr ) {
     1602        void AlternativeFinder::Finder::postvisit( CommaExpr *commaExpr ) {
    15271603                TypeEnvironment newEnv( env );
    15281604                Expression *newFirstArg = resolveInVoidContext( commaExpr->get_arg1(), indexer, newEnv );
     
    15351611        }
    15361612
    1537         void AlternativeFinder::visit( RangeExpr * rangeExpr ) {
     1613        void AlternativeFinder::Finder::postvisit( RangeExpr * rangeExpr ) {
    15381614                // resolve low and high, accept alternatives whose low and high types unify
    15391615                AlternativeFinder firstFinder( indexer, env );
    15401616                firstFinder.findWithAdjustment( rangeExpr->get_low() );
     1617                if ( firstFinder.alternatives.empty() ) return;
     1618                AlternativeFinder secondFinder( indexer, env );
     1619                secondFinder.findWithAdjustment( rangeExpr->get_high() );
     1620                if ( secondFinder.alternatives.empty() ) return;
    15411621                for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) {
    1542                         AlternativeFinder secondFinder( indexer, first->env );
    1543                         secondFinder.findWithAdjustment( rangeExpr->get_high() );
    15441622                        for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) {
     1623                                TypeEnvironment compositeEnv;
     1624                                compositeEnv.simpleCombine( first->env );
     1625                                compositeEnv.simpleCombine( second->env );
    15451626                                OpenVarSet openVars;
    15461627                                AssertionSet needAssertions, haveAssertions;
    1547                                 Alternative newAlt( 0, second->env, first->cost + second->cost );
     1628                                Alternative newAlt( 0, compositeEnv, first->cost + second->cost );
    15481629                                Type* commonType = nullptr;
    15491630                                if ( unify( first->expr->get_result(), second->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
     
    15571638        }
    15581639
    1559         void AlternativeFinder::visit( UntypedTupleExpr *tupleExpr ) {
     1640        void AlternativeFinder::Finder::postvisit( UntypedTupleExpr *tupleExpr ) {
    15601641                std::vector< AlternativeFinder > subExprAlternatives;
    1561                 findSubExprs( tupleExpr->get_exprs().begin(), tupleExpr->get_exprs().end(),
     1642                altFinder.findSubExprs( tupleExpr->get_exprs().begin(), tupleExpr->get_exprs().end(),
    15621643                        back_inserter( subExprAlternatives ) );
    15631644                std::vector< AltList > possibilities;
     
    15751656        }
    15761657
    1577         void AlternativeFinder::visit( TupleExpr *tupleExpr ) {
     1658        void AlternativeFinder::Finder::postvisit( TupleExpr *tupleExpr ) {
    15781659                alternatives.push_back( Alternative( tupleExpr->clone(), env, Cost::zero ) );
    15791660        }
    15801661
    1581         void AlternativeFinder::visit( ImplicitCopyCtorExpr * impCpCtorExpr ) {
     1662        void AlternativeFinder::Finder::postvisit( ImplicitCopyCtorExpr * impCpCtorExpr ) {
    15821663                alternatives.push_back( Alternative( impCpCtorExpr->clone(), env, Cost::zero ) );
    15831664        }
    15841665
    1585         void AlternativeFinder::visit( ConstructorExpr * ctorExpr ) {
     1666        void AlternativeFinder::Finder::postvisit( ConstructorExpr * ctorExpr ) {
    15861667                AlternativeFinder finder( indexer, env );
    15871668                // don't prune here, since it's guaranteed all alternatives will have the same type
     
    15931674        }
    15941675
    1595         void AlternativeFinder::visit( TupleIndexExpr *tupleExpr ) {
     1676        void AlternativeFinder::Finder::postvisit( TupleIndexExpr *tupleExpr ) {
    15961677                alternatives.push_back( Alternative( tupleExpr->clone(), env, Cost::zero ) );
    15971678        }
    15981679
    1599         void AlternativeFinder::visit( TupleAssignExpr *tupleAssignExpr ) {
     1680        void AlternativeFinder::Finder::postvisit( TupleAssignExpr *tupleAssignExpr ) {
    16001681                alternatives.push_back( Alternative( tupleAssignExpr->clone(), env, Cost::zero ) );
    16011682        }
    16021683
    1603         void AlternativeFinder::visit( UniqueExpr *unqExpr ) {
     1684        void AlternativeFinder::Finder::postvisit( UniqueExpr *unqExpr ) {
    16041685                AlternativeFinder finder( indexer, env );
    16051686                finder.findWithAdjustment( unqExpr->get_expr() );
     
    16111692        }
    16121693
    1613         void AlternativeFinder::visit( StmtExpr *stmtExpr ) {
     1694        void AlternativeFinder::Finder::postvisit( StmtExpr *stmtExpr ) {
    16141695                StmtExpr * newStmtExpr = stmtExpr->clone();
    16151696                ResolvExpr::resolveStmtExpr( newStmtExpr, indexer );
     
    16181699        }
    16191700
    1620         void AlternativeFinder::visit( UntypedInitExpr *initExpr ) {
     1701        void AlternativeFinder::Finder::postvisit( UntypedInitExpr *initExpr ) {
    16211702                // handle each option like a cast
    16221703                AltList candidates;
    1623                 PRINT( std::cerr << "untyped init expr: " << initExpr << std::endl; )
     1704                PRINT(
     1705                        std::cerr << "untyped init expr: " << initExpr << std::endl;
     1706                )
    16241707                // O(N^2) checks of d-types with e-types
    16251708                for ( InitAlternative & initAlt : initExpr->get_initAlts() ) {
     
    16371720                                AssertionSet needAssertions, haveAssertions;
    16381721                                OpenVarSet openVars;  // find things in env that don't have a "representative type" and claim those are open vars?
    1639                                 PRINT( std::cerr << "  @ " << toType << " " << initAlt.designation << std::endl; )
     1722                                PRINT(
     1723                                        std::cerr << "  @ " << toType << " " << initAlt.designation << std::endl;
     1724                                 )
    16401725                                // It's possible that a cast can throw away some values in a multiply-valued expression.  (An example is a
    16411726                                // cast-to-void, which casts from one value to zero.)  Figure out the prefix of the subexpression results
Note: See TracChangeset for help on using the changeset viewer.