Changes in src/GenPoly/Box.cc [f18a711:ea5daeb]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
rf18a711 rea5daeb 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 DynRetParam( 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 ); 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 DynRet( functionDecl->get_functionType() ) && functionDecl->get_linkage() == LinkageSpec::Cforall ) {663 if ( isPolyRet( 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 DynRetParam( 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 ) { 871 871 assert( env ); 872 Type *concrete = replaceWithConcrete( appExpr, dynType );872 Type *concrete = replaceWithConcrete( appExpr, polyType ); 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 ) ) { 880 if ( isDynRet( function, tyVars ) ) { 879 if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) { 881 880 ret = addRetParam( appExpr, function, function->get_returnVals().front()->get_type(), arg ); 882 881 } // if … … 969 968 // actually make the adapter type 970 969 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 ) ) { 973 971 makeRetParm( adapter ); 974 972 } // if … … 1032 1030 addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars ); 1033 1031 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 ) ) { 1036 1033 // return type T 1037 1034 if ( (*param)->get_name() == "" ) { … … 1280 1277 TyVarMap exprTyVars( (TypeDecl::Kind)-1 ); 1281 1278 makeTyVarMap( function, exprTyVars ); 1282 ReferenceToType * dynRetType = isDynRet( function, exprTyVars);1283 1284 if ( dynRetType ) {1285 ret = add DynRetParam( appExpr, function, dynRetType, arg );1279 ReferenceToType *polyRetType = isPolyRet( function ); 1280 1281 if ( polyRetType ) { 1282 ret = addPolyRetParam( appExpr, function, polyRetType, arg ); 1286 1283 } else if ( needsAdapter( function, scopeTyVars ) ) { 1287 1284 // std::cerr << "needs adapter: "; … … 1293 1290 arg = appExpr->get_args().begin(); 1294 1291 1295 passTypeVars( appExpr, dynRetType, arg, exprTyVars );1292 passTypeVars( appExpr, polyRetType, arg, exprTyVars ); 1296 1293 addInferredParams( appExpr, function, arg, exprTyVars ); 1297 1294 … … 1580 1577 1581 1578 // move polymorphic return type to parameter list 1582 if ( is DynRet( funcType ) ) {1579 if ( isPolyRet( funcType ) ) { 1583 1580 DeclarationWithType *ret = funcType->get_returnVals().front(); 1584 1581 ret->set_type( new PointerType( Type::Qualifiers(), ret->get_type() ) );
Note:
See TracChangeset
for help on using the changeset viewer.