Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    rf18a711 rea5daeb  
    104104                        Type *replaceWithConcrete( ApplicationExpr *appExpr, Type *type, bool doClone = true );
    105105                        /// wraps a function application returning a polymorphic type with a new temporary for the out-parameter return value
    106                         Expression *addDynRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *polyType, std::list< Expression *>::iterator &arg );
     106                        Expression *addPolyRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *polyType, std::list< Expression *>::iterator &arg );
    107107                        Expression *applyAdapter( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars );
    108108                        void boxParam( Type *formal, Expression *&arg, const TyVarMap &exprTyVars );
     
    661661                                // process polymorphic return value
    662662                                retval = 0;
    663                                 if ( isDynRet( functionDecl->get_functionType() ) && functionDecl->get_linkage() == LinkageSpec::Cforall ) {
     663                                if ( isPolyRet( functionDecl->get_functionType() ) && functionDecl->get_linkage() == LinkageSpec::Cforall ) {
    664664                                        retval = functionDecl->get_functionType()->get_returnVals().front();
    665665
     
    868868                }
    869869
    870                 Expression *Pass1::addDynRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *dynType, std::list< Expression *>::iterator &arg ) {
     870                Expression *Pass1::addPolyRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *polyType, std::list< Expression *>::iterator &arg ) {
    871871                        assert( env );
    872                         Type *concrete = replaceWithConcrete( appExpr, dynType );
     872                        Type *concrete = replaceWithConcrete( appExpr, polyType );
    873873                        // add out-parameter for return value
    874874                        return addRetParam( appExpr, function, concrete, arg );
     
    877877                Expression *Pass1::applyAdapter( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ) {
    878878                        Expression *ret = appExpr;
    879 //                      if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) {
    880                         if ( isDynRet( function, tyVars ) ) {
     879                        if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) {
    881880                                ret = addRetParam( appExpr, function, function->get_returnVals().front()->get_type(), arg );
    882881                        } // if
     
    969968                        // actually make the adapter type
    970969                        FunctionType *adapter = adaptee->clone();
    971 //                      if ( ! adapter->get_returnVals().empty() && isPolyType( adapter->get_returnVals().front()->get_type(), tyVars ) ) {
    972                         if ( isDynRet( adapter, tyVars ) ) {
     970                        if ( ! adapter->get_returnVals().empty() && isPolyType( adapter->get_returnVals().front()->get_type(), tyVars ) ) {
    973971                                makeRetParm( adapter );
    974972                        } // if
     
    10321030                                addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
    10331031                                bodyStmt = new ExprStmt( noLabels, adapteeApp );
    1034 //                      } else if ( isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
    1035                         } else if ( isDynType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
     1032                        } else if ( isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
    10361033                                // return type T
    10371034                                if ( (*param)->get_name() == "" ) {
     
    12801277                        TyVarMap exprTyVars( (TypeDecl::Kind)-1 );
    12811278                        makeTyVarMap( function, exprTyVars );
    1282                         ReferenceToType *dynRetType = isDynRet( function, exprTyVars );
    1283 
    1284                         if ( dynRetType ) {
    1285                                 ret = addDynRetParam( appExpr, function, dynRetType, arg );
     1279                        ReferenceToType *polyRetType = isPolyRet( function );
     1280
     1281                        if ( polyRetType ) {
     1282                                ret = addPolyRetParam( appExpr, function, polyRetType, arg );
    12861283                        } else if ( needsAdapter( function, scopeTyVars ) ) {
    12871284                                // std::cerr << "needs adapter: ";
     
    12931290                        arg = appExpr->get_args().begin();
    12941291
    1295                         passTypeVars( appExpr, dynRetType, arg, exprTyVars );
     1292                        passTypeVars( appExpr, polyRetType, arg, exprTyVars );
    12961293                        addInferredParams( appExpr, function, arg, exprTyVars );
    12971294
     
    15801577
    15811578                        // move polymorphic return type to parameter list
    1582                         if ( isDynRet( funcType ) ) {
     1579                        if ( isPolyRet( funcType ) ) {
    15831580                                DeclarationWithType *ret = funcType->get_returnVals().front();
    15841581                                ret->set_type( new PointerType( Type::Qualifiers(), ret->get_type() ) );
Note: See TracChangeset for help on using the changeset viewer.