Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.h

    rac9ca96 rb6fe7e6  
    6767                virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr );
    6868                virtual void visit( ConstructorExpr * ctorExpr );
    69                 virtual void visit( TupleIndexExpr *tupleExpr );
    70                 virtual void visit( TupleAssignExpr *tupleExpr );
    71                 /// Runs a new alternative finder on each element in [begin, end)
    72                 /// and writes each alternative finder to out.
     69          public:  // xxx - temporary hack - should make Tuples::TupleAssignment a friend
    7370                template< typename InputIterator, typename OutputIterator >
    7471                void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
    7572
     73          private:
    7674                /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member
    77                 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
     75                template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string &name );
    7876                /// Adds alternatives for offsetof expressions, given the base type and name of the member
    7977                template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name );
    80                 bool instantiateFunction( std::list< DeclarationWithType* >& formals, const AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave, AltList & out );
     78                bool instantiateFunction( std::list< DeclarationWithType* >& formals, /*const*/ AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave );
    8179                template< typename OutputIterator >
    82                 void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const AltList &actualAlt, OutputIterator out );
     80                void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, AltList &actualAlt, OutputIterator out );
    8381                template< typename OutputIterator >
    8482                void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out );
     
    9189
    9290        Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env );
    93 
    94         template< typename InputIterator, typename OutputIterator >
    95         void findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {
    96                 AltList alternatives;
    97 
    98                 // select the alternatives that have the minimum parameter cost
    99                 Cost minCost = Cost::infinity;
    100                 for ( InputIterator i = begin; i != end; ++i ) {
    101                         if ( i->cost < minCost ) {
    102                                 minCost = i->cost;
    103                                 i->cost = i->cvtCost;
    104                                 alternatives.clear();
    105                                 alternatives.push_back( *i );
    106                         } else if ( i->cost == minCost ) {
    107                                 i->cost = i->cvtCost;
    108                                 alternatives.push_back( *i );
    109                         }
    110                 }
    111                 std::copy( alternatives.begin(), alternatives.end(), out );
    112         }
    113 
    114         Cost sumCost( const AltList &in );
    115 
    116         template< typename InputIterator >
    117         void simpleCombineEnvironments( InputIterator begin, InputIterator end, TypeEnvironment &result ) {
    118                 while ( begin != end ) {
    119                         result.simpleCombine( (*begin++).env );
    120                 }
    121         }
    12291} // namespace ResolvExpr
    12392
Note: See TracChangeset for help on using the changeset viewer.