- Timestamp:
- Oct 17, 2023, 2:14:34 PM (11 months ago)
- Branches:
- master
- Children:
- ca995e3
- Parents:
- 37ceccb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/BoxNew.cpp
r37ceccb r5e0bba5 39 39 40 40 namespace { 41 42 // TODO: Could this be a common helper somewhere?43 ast::FunctionType * makeFunctionType( ast::FunctionDecl const * decl ) {44 ast::FunctionType * type = new ast::FunctionType(45 decl->type->isVarArgs, decl->type->qualifiers46 );47 for ( auto type_param : decl->type_params ) {48 type->forall.emplace_back( new ast::TypeInstType( type_param ) );49 }50 for ( auto assertion : decl->assertions ) {51 type->assertions.emplace_back( new ast::VariableExpr(52 assertion->location, assertion ) );53 }54 for ( auto param : decl->params ) {55 type->params.emplace_back( param->get_type() );56 }57 for ( auto retval : decl->returns ) {58 type->returns.emplace_back( retval->get_type() );59 }60 return type;61 }62 41 63 42 // -------------------------------------------------------------------------- … … 1434 1413 layoutParams.emplace_back( alignParam ); 1435 1414 } 1436 // TODO: These should possibly all be gone. 1437 // More all assertions into parameter list. 1438 for ( ast::ptr<ast::DeclWithType> & assert : mutParam->assertions ) { 1439 // Assertion parameters may not be used in body, 1440 // pass along with unused attribute. 1441 assert.get_and_mutate()->attributes.push_back( 1442 new ast::Attribute( "unused" ) ); 1443 inferredParams.push_back( assert ); 1444 } 1445 mutParam->assertions.clear(); 1415 // Assertions should be stored in the main list. 1416 assert( mutParam->assertions.empty() ); 1446 1417 typeParam = mutParam; 1447 1418 } 1448 // TODO: New version of inner loop.1449 1419 for ( ast::ptr<ast::DeclWithType> & assert : mutDecl->assertions ) { 1450 1420 // Assertion parameters may not be used in body, … … 1461 1431 spliceBegin( mutDecl->params, layoutParams ); 1462 1432 addAdapters( mutDecl, localTypeVars ); 1433 1434 // Now have to update the type to match the declaration. 1435 ast::FunctionType * type = new ast::FunctionType( 1436 mutDecl->type->isVarArgs, mutDecl->type->qualifiers ); 1437 for ( auto type_param : mutDecl->type_params ) { 1438 type->forall.emplace_back( new ast::TypeInstType( type_param ) ); 1439 } 1440 for ( auto param : mutDecl->params ) { 1441 type->params.emplace_back( param->get_type() ); 1442 } 1443 for ( auto retval : mutDecl->returns ) { 1444 type->returns.emplace_back( retval->get_type() ); 1445 } 1446 mutDecl->type = type; 1463 1447 1464 1448 return mutDecl; … … 1494 1478 } 1495 1479 } 1496 // TODO: Can this be updated as we go along?1497 mutDecl->type = makeFunctionType( mutDecl );1498 1480 return mutDecl; 1499 1481 }
Note: See TracChangeset
for help on using the changeset viewer.