Changeset 7156c46


Ignore:
Timestamp:
Aug 11, 2023, 11:24:34 AM (9 months ago)
Author:
caparsons <caparson@…>
Branches:
master
Children:
409bb8f, 89bef959, c1f502c
Parents:
b2ab352
Message:

added code to copy attributes from vtable decl to generated decl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/ExceptDeclNew.cpp

    rb2ab352 r7156c46  
    242242}
    243243
    244 ast::ObjectDecl const * createExternVTable(
     244static ast::ObjectDecl * createExternVTable(
    245245                CodeLocation const & location,
    246246                std::string const & exceptionName,
     
    356356}
    357357
    358 ast::ObjectDecl const * createVirtualTable(
     358ast::ObjectDecl * createVirtualTable(
    359359                CodeLocation const & location,
    360360                std::string const & exceptionName,
     
    451451        std::string const & tableName = decl->name;
    452452
     453    ast::ObjectDecl * retDecl;
    453454        if ( decl->storage.is_extern ) {
    454455                // Unique type-ids are only needed for polymorphic instances.
     
    457458                                createExternTypeId( location, exceptionName, params ) );
    458459                }
    459                 return createExternVTable( location, exceptionName, params, tableName );
     460                retDecl = createExternVTable( location, exceptionName, params, tableName );
    460461        } else {
    461462                // Unique type-ids are only needed for polymorphic instances.
     
    468469                declsToAddBefore.push_back(
    469470                        createMsg( location, exceptionName, params ) );
    470                 return createVirtualTable(
     471                retDecl = createVirtualTable(
    471472                        location, exceptionName, params, tableName );
    472473        }
     474
     475    for ( ast::ptr<ast::Attribute> const & attr : decl->attributes ) {
     476        retDecl->attributes.push_back( attr );
     477    }
     478
     479    return retDecl;
    473480}
    474481
     
    476483        ast::StructInstType const * postvisit( ast::VTableType const * type ) {
    477484                auto inst = type->base.as<ast::BaseInstType>();
    478 
     485       
    479486                std::string vtableName = Virtual::vtableTypeName( inst->name );
     487
    480488                auto newType = new ast::StructInstType( vtableName );
    481489                for ( ast::ptr<ast::Expr> const & param : inst->params ) {
Note: See TracChangeset for help on using the changeset viewer.