Changes in src/Concurrency/Keywords.cc [ecfd758:43cedfb1]
- File:
-
- 1 edited
-
src/Concurrency/Keywords.cc (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Keywords.cc
recfd758 r43cedfb1 42 42 43 43 namespace Concurrency { 44 inline static std::string getTypeIdName( std::string const & exception_name ) {45 return exception_name.empty() ? std::string() : Virtual::typeIdType( exception_name );46 }47 44 inline static std::string getVTableName( std::string const & exception_name ) { 48 return exception_name.empty() ? std::string() : Virtual::vtableTypeName( exception_name);45 return exception_name.empty() ? std::string() : Virtual::vtableTypeName(exception_name); 49 46 } 50 47 … … 78 75 type_name( type_name ), field_name( field_name ), getter_name( getter_name ), 79 76 context_error( context_error ), exception_name( exception_name ), 80 typeid_name( getTypeIdName( exception_name ) ),81 77 vtable_name( getVTableName( exception_name ) ), 82 78 needs_main( needs_main ), cast_target( cast_target ) {} … … 88 84 89 85 void handle( StructDecl * ); 90 void addTypeId( StructDecl * );91 86 void addVtableForward( StructDecl * ); 92 87 FunctionDecl * forwardDeclare( StructDecl * ); … … 104 99 const std::string context_error; 105 100 const std::string exception_name; 106 const std::string typeid_name;107 101 const std::string vtable_name; 108 102 bool needs_main; … … 112 106 FunctionDecl * dtor_decl = nullptr; 113 107 StructDecl * except_decl = nullptr; 114 StructDecl * typeid_decl = nullptr;115 108 StructDecl * vtable_decl = nullptr; 116 109 }; … … 399 392 else if ( !except_decl && exception_name == decl->name && decl->body ) { 400 393 except_decl = decl; 401 }402 else if ( !typeid_decl && typeid_name == decl->name && decl->body ) {403 typeid_decl = decl;404 394 } 405 395 else if ( !vtable_decl && vtable_name == decl->name && decl->body ) { … … 458 448 if( !dtor_decl ) SemanticError( decl, context_error ); 459 449 460 if ( !exception_name.empty() ) { 461 if( !typeid_decl ) SemanticError( decl, context_error ); 462 if( !vtable_decl ) SemanticError( decl, context_error ); 463 464 addTypeId( decl ); 465 addVtableForward( decl ); 466 } 450 addVtableForward( decl ); 467 451 FunctionDecl * func = forwardDeclare( decl ); 468 452 ObjectDecl * field = addField( decl ); … … 470 454 } 471 455 472 void ConcurrentSueKeyword::addTypeId( StructDecl * decl ) { 473 assert( typeid_decl ); 474 StructInstType typeid_type( Type::Const, typeid_decl ); 475 typeid_type.parameters.push_back( new TypeExpr( 476 new StructInstType( noQualifiers, decl ) 456 void ConcurrentSueKeyword::addVtableForward( StructDecl * decl ) { 457 if ( vtable_decl ) { 458 std::list< Expression * > poly_args = { 459 new TypeExpr( new StructInstType( noQualifiers, decl ) ), 460 }; 461 declsToAddBefore.push_back( Virtual::makeGetExceptionForward( 462 vtable_decl->makeInst( poly_args ), 463 except_decl->makeInst( poly_args ) 477 464 ) ); 478 declsToAddBefore.push_back( Virtual::makeTypeIdInstance( &typeid_type ) ); 479 } 480 481 void ConcurrentSueKeyword::addVtableForward( StructDecl * decl ) { 482 assert( vtable_decl ); 483 std::list< Expression * > poly_args = { 484 new TypeExpr( new StructInstType( noQualifiers, decl ) ), 485 }; 486 declsToAddBefore.push_back( Virtual::makeGetExceptionForward( 487 vtable_decl->makeInst( poly_args ), 488 except_decl->makeInst( poly_args ) 489 ) ); 490 declsToAddBefore.push_back( Virtual::makeVtableForward( 491 vtable_decl->makeInst( move( poly_args ) ) ) ); 465 declsToAddBefore.push_back( Virtual::makeVtableForward( 466 vtable_decl->makeInst( move( poly_args ) ) ) ); 467 // Its only an error if we want a vtable and don't have one. 468 } else if ( ! vtable_name.empty() ) { 469 SemanticError( decl, context_error ); 470 } 492 471 } 493 472
Note:
See TracChangeset
for help on using the changeset viewer.