Changeset 7e003011 for src/GenPoly
- Timestamp:
- Jun 5, 2017, 1:59:11 PM (7 years ago)
- 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:
- 7b13aeb
- Parents:
- b3c36f4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
rb3c36f4 r7e003011 103 103 void passTypeVars( ApplicationExpr *appExpr, Type *polyRetType, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ); 104 104 /// wraps a function application with a new temporary for the out-parameter return value 105 Expression *addRetParam( ApplicationExpr *appExpr, FunctionType *function,Type *retType, std::list< Expression *>::iterator &arg );105 Expression *addRetParam( ApplicationExpr *appExpr, Type *retType, std::list< Expression *>::iterator &arg ); 106 106 /// Replaces all the type parameters of a generic type with their concrete equivalents under the current environment 107 107 void replaceParametersWithConcrete( ApplicationExpr *appExpr, std::list< Expression* >& params ); … … 136 136 public: 137 137 template< typename DeclClass > 138 DeclClass *handleDecl( DeclClass *decl , Type *type);138 DeclClass *handleDecl( DeclClass *decl ); 139 139 template< typename AggDecl > 140 140 AggDecl * handleAggDecl( AggDecl * aggDecl ); … … 665 665 } 666 666 667 Expression *Pass1::addRetParam( ApplicationExpr *appExpr, FunctionType *function,Type *retType, std::list< Expression *>::iterator &arg ) {667 Expression *Pass1::addRetParam( ApplicationExpr *appExpr, Type *retType, std::list< Expression *>::iterator &arg ) { 668 668 // Create temporary to hold return value of polymorphic function and produce that temporary as a result 669 669 // using a comma expression. … … 732 732 Type *concrete = replaceWithConcrete( appExpr, dynType ); 733 733 // add out-parameter for return value 734 return addRetParam( appExpr, function,concrete, arg );734 return addRetParam( appExpr, concrete, arg ); 735 735 } 736 736 … … 739 739 // if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) { 740 740 if ( isDynRet( function, tyVars ) ) { 741 ret = addRetParam( appExpr, function , function->get_returnVals().front()->get_type(), arg );741 ret = addRetParam( appExpr, function->get_returnVals().front()->get_type(), arg ); 742 742 } // if 743 743 std::string mangleName = mangleAdapterName( function, tyVars ); … … 1282 1282 1283 1283 template< typename DeclClass > 1284 DeclClass * Pass2::handleDecl( DeclClass *decl , Type *type) {1284 DeclClass * Pass2::handleDecl( DeclClass *decl ) { 1285 1285 DeclClass *ret = static_cast< DeclClass *>( Parent::mutate( decl ) ); 1286 1286 … … 1296 1296 1297 1297 DeclarationWithType * Pass2::mutate( FunctionDecl *functionDecl ) { 1298 functionDecl = safe_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl , functionDecl->get_functionType()) );1298 functionDecl = safe_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl ) ); 1299 1299 FunctionType * ftype = functionDecl->get_functionType(); 1300 1300 if ( ! ftype->get_returnVals().empty() && functionDecl->get_statements() ) { … … 1321 1321 1322 1322 ObjectDecl * Pass2::mutate( ObjectDecl *objectDecl ) { 1323 return handleDecl( objectDecl , objectDecl->get_type());1323 return handleDecl( objectDecl ); 1324 1324 } 1325 1325 … … 1344 1344 addToTyVarMap( typeDecl, scopeTyVars ); 1345 1345 if ( typeDecl->get_base() ) { 1346 return handleDecl( typeDecl , typeDecl->get_base());1346 return handleDecl( typeDecl ); 1347 1347 } else { 1348 1348 return Parent::mutate( typeDecl ); … … 1351 1351 1352 1352 TypedefDecl * Pass2::mutate( TypedefDecl *typedefDecl ) { 1353 return handleDecl( typedefDecl , typedefDecl->get_base());1353 return handleDecl( typedefDecl ); 1354 1354 } 1355 1355
Note: See TracChangeset
for help on using the changeset viewer.