Changeset 6009a5a
- Timestamp:
- Nov 30, 2023, 12:10:06 PM (13 months ago)
- Branches:
- master
- Children:
- 83fd57d
- Parents:
- ab9c1b3
- Location:
- src/Tuples
- Files:
-
- 1 deleted
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/Tuples/TupleExpansion.cpp
rab9c1b3 r6009a5a 294 294 } 295 295 296 const ast::Type * makeTupleType( const std::vector<ast::ptr<ast::Expr>> & exprs ) { 297 // If there are no expressions, the answer is set, otherwise go through a loop. 298 if ( exprs.empty() ) return new ast::TupleType( {} ); 299 300 std::vector<ast::ptr<ast::Type>> types; 301 ast::CV::Qualifiers quals( 302 ast::CV::Const | ast::CV::Volatile | ast::CV::Restrict | 303 ast::CV::Atomic | ast::CV::Mutex ); 304 305 for ( const ast::Expr * expr : exprs ) { 306 assert( expr->result ); 307 // If the type of any expr is void, the type of the entire tuple is void. 308 if ( expr->result->isVoid() ) return new ast::VoidType(); 309 310 // Qualifiers on the tuple type are the qualifiers that exist on all components. 311 quals &= expr->result->qualifiers; 312 313 types.emplace_back( expr->result ); 314 } 315 316 return new ast::TupleType( std::move( types ), quals ); 317 } 318 319 const ast::TypeInstType * isTtype( const ast::Type * type ) { 320 if ( const ast::TypeInstType * inst = dynamic_cast< const ast::TypeInstType * >( type ) ) { 321 if ( inst->base && inst->base->kind == ast::TypeDecl::Ttype ) { 322 return inst; 323 } 324 } 325 return nullptr; 326 } 327 296 328 } // namespace Tuples 329 -
src/Tuples/module.mk
rab9c1b3 r6009a5a 19 19 Tuples/Explode.h \ 20 20 Tuples/TupleAssignment.cc \ 21 Tuples/TupleExpansion.cc \ 22 Tuples/TupleExpansionNew.cpp \ 21 Tuples/TupleExpansion.cpp \ 23 22 Tuples/Tuples.cc \ 24 23 Tuples/Tuples.h
Note: See TracChangeset
for help on using the changeset viewer.