Changeset c97b448 for src/GenPoly/GenPoly.cc
- Timestamp:
- Feb 13, 2023, 11:17:08 AM (19 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- f6bceeb
- Parents:
- f26421f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/GenPoly.cc
rf26421f rc97b448 275 275 } 276 276 277 const ast::BaseInstType *isDynRet( const ast::FunctionType * func ) { 278 if ( func->returns.empty() ) return nullptr; 279 280 TypeVarMap forallTypes = { ast::TypeData() }; 281 makeTypeVarMap( func, forallTypes ); 282 return isDynType( func->returns.front(), forallTypes ); 283 } 284 277 285 bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars ) { 278 286 // if ( ! adaptee->get_returnVals().empty() && isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) { … … 319 327 return 0; 320 328 } 329 330 const ast::Type * isPolyPtr( 331 const ast::Type * type, const TypeVarMap & typeVars, 332 const ast::TypeSubstitution * typeSubs ) { 333 type = replaceTypeInst( type, typeSubs ); 334 335 if ( auto * ptr = dynamic_cast<ast::PointerType const *>( type ) ) { 336 return isPolyType( ptr->base, typeVars, typeSubs ); 337 } 338 return nullptr; 339 } 321 340 322 341 Type * hasPolyBase( Type *type, int *levels, const TypeSubstitution *env ) { … … 796 815 } 797 816 817 void addToTypeVarMap( const ast::TypeDecl * decl, TypeVarMap & typeVars ) { 818 typeVars.insert( ast::TypeEnvKey( decl, 0, 0 ), ast::TypeData( decl ) ); 819 } 820 798 821 void addToTypeVarMap( const ast::TypeInstType * type, TypeVarMap & typeVars ) { 799 typeVars.insert( *type, ast::TypeData( type->base ) );822 typeVars.insert( ast::TypeEnvKey( *type ), ast::TypeData( type->base ) ); 800 823 } 801 824 … … 822 845 } 823 846 847 void makeTypeVarMap( const ast::FunctionDecl * decl, TypeVarMap & typeVars ) { 848 for ( auto & typeDecl : decl->type_params ) { 849 addToTypeVarMap( typeDecl, typeVars ); 850 } 851 } 852 824 853 void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap ) { 825 854 for ( TyVarMap::const_iterator i = tyVarMap.begin(); i != tyVarMap.end(); ++i ) {
Note: See TracChangeset
for help on using the changeset viewer.