Changeset b1e21da for src/Validate/Autogen.cpp
- Timestamp:
- Jun 16, 2023, 6:40:44 PM (14 months ago)
- Branches:
- master
- Children:
- 0e0f25d5
- Parents:
- 64727bd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Validate/Autogen.cpp
r64727bd rb1e21da 321 321 void FuncGenerator::produceDecl( const ast::FunctionDecl * decl ) { 322 322 assert( nullptr != decl->stmts ); 323 const auto & oldParams = getGenericParams(type); 324 assert( decl->type_params.size() == oldParams.size()); 325 326 /* 327 ast::DeclReplacer::TypeMap typeMap; 328 for (auto it = oldParams.begin(), jt = decl->type_params.begin(); it != oldParams.end(); ++it, ++jt) { 329 typeMap.emplace(*it, *jt); 330 } 331 332 const ast::FunctionDecl * mut = strict_dynamic_cast<const ast::FunctionDecl *>(ast::DeclReplacer::replace(decl, typeMap)); 333 assert (mut == decl); 334 */ 323 assert( decl->type_params.size() == getGenericParams( type ).size() ); 335 324 336 325 definitions.push_back( decl ); … … 364 353 std::vector<ast::ptr<ast::TypeDecl>> type_params; 365 354 std::vector<ast::ptr<ast::DeclWithType>> assertions; 366 367 ast::DeclReplacer::TypeMap typeMap;368 355 for ( auto & old_param : old_type_params ) { 369 356 ast::TypeDecl * decl = ast::deepCopy( old_param ); 370 357 decl->init = nullptr; 371 358 splice( assertions, decl->assertions ); 372 oldToNew.emplace( std::make_pair( old_param, decl ));359 oldToNew.emplace( old_param, decl ); 373 360 type_params.push_back( decl ); 374 typeMap.emplace(old_param, decl);375 }376 377 for (auto & param : params) {378 param = ast::DeclReplacer::replace(param, typeMap);379 }380 for (auto & param : returns) {381 param = ast::DeclReplacer::replace(param, typeMap);382 361 } 383 362 replaceAll( params, oldToNew );
Note: See TracChangeset
for help on using the changeset viewer.