Changes in src/GenPoly/Box.cc [ea5daeb:f18a711]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
rea5daeb rf18a711 104 104 Type *replaceWithConcrete( ApplicationExpr *appExpr, Type *type, bool doClone = true ); 105 105 /// wraps a function application returning a polymorphic type with a new temporary for the out-parameter return value 106 Expression *add PolyRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *polyType, std::list< Expression *>::iterator &arg );106 Expression *addDynRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *polyType, std::list< Expression *>::iterator &arg ); 107 107 Expression *applyAdapter( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ); 108 108 void boxParam( Type *formal, Expression *&arg, const TyVarMap &exprTyVars ); … … 661 661 // process polymorphic return value 662 662 retval = 0; 663 if ( is PolyRet( functionDecl->get_functionType() ) && functionDecl->get_linkage() == LinkageSpec::Cforall ) {663 if ( isDynRet( functionDecl->get_functionType() ) && functionDecl->get_linkage() == LinkageSpec::Cforall ) { 664 664 retval = functionDecl->get_functionType()->get_returnVals().front(); 665 665 … … 868 868 } 869 869 870 Expression *Pass1::add PolyRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *polyType, std::list< Expression *>::iterator &arg ) {870 Expression *Pass1::addDynRetParam( ApplicationExpr *appExpr, FunctionType *function, ReferenceToType *dynType, std::list< Expression *>::iterator &arg ) { 871 871 assert( env ); 872 Type *concrete = replaceWithConcrete( appExpr, polyType );872 Type *concrete = replaceWithConcrete( appExpr, dynType ); 873 873 // add out-parameter for return value 874 874 return addRetParam( appExpr, function, concrete, arg ); … … 877 877 Expression *Pass1::applyAdapter( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ) { 878 878 Expression *ret = appExpr; 879 if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) { 879 // if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) { 880 if ( isDynRet( function, tyVars ) ) { 880 881 ret = addRetParam( appExpr, function, function->get_returnVals().front()->get_type(), arg ); 881 882 } // if … … 968 969 // actually make the adapter type 969 970 FunctionType *adapter = adaptee->clone(); 970 if ( ! adapter->get_returnVals().empty() && isPolyType( adapter->get_returnVals().front()->get_type(), tyVars ) ) { 971 // if ( ! adapter->get_returnVals().empty() && isPolyType( adapter->get_returnVals().front()->get_type(), tyVars ) ) { 972 if ( isDynRet( adapter, tyVars ) ) { 971 973 makeRetParm( adapter ); 972 974 } // if … … 1030 1032 addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars ); 1031 1033 bodyStmt = new ExprStmt( noLabels, adapteeApp ); 1032 } else if ( isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) { 1034 // } else if ( isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) { 1035 } else if ( isDynType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) { 1033 1036 // return type T 1034 1037 if ( (*param)->get_name() == "" ) { … … 1277 1280 TyVarMap exprTyVars( (TypeDecl::Kind)-1 ); 1278 1281 makeTyVarMap( function, exprTyVars ); 1279 ReferenceToType * polyRetType = isPolyRet( function);1280 1281 if ( polyRetType ) {1282 ret = add PolyRetParam( appExpr, function, polyRetType, arg );1282 ReferenceToType *dynRetType = isDynRet( function, exprTyVars ); 1283 1284 if ( dynRetType ) { 1285 ret = addDynRetParam( appExpr, function, dynRetType, arg ); 1283 1286 } else if ( needsAdapter( function, scopeTyVars ) ) { 1284 1287 // std::cerr << "needs adapter: "; … … 1290 1293 arg = appExpr->get_args().begin(); 1291 1294 1292 passTypeVars( appExpr, polyRetType, arg, exprTyVars );1295 passTypeVars( appExpr, dynRetType, arg, exprTyVars ); 1293 1296 addInferredParams( appExpr, function, arg, exprTyVars ); 1294 1297 … … 1577 1580 1578 1581 // move polymorphic return type to parameter list 1579 if ( is PolyRet( funcType ) ) {1582 if ( isDynRet( funcType ) ) { 1580 1583 DeclarationWithType *ret = funcType->get_returnVals().front(); 1581 1584 ret->set_type( new PointerType( Type::Qualifiers(), ret->get_type() ) );
Note:
See TracChangeset
for help on using the changeset viewer.