Ignore:
Timestamp:
Sep 21, 2022, 9:22:24 AM (2 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
20737104
Parents:
b6c3688
Message:

Used the WithCodeLocation? helper in more passes. This cleans up some code and should improve efficiency.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Validate/LinkReferenceToTypes.cpp

    rb6c3688 re9e9f56  
    1010// Created On       : Thr Apr 21 11:41:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Jun 28 14:58:00 2022
    13 // Update Count     : 1
     12// Last Modified On : Tue Sep 20 16:17:00 2022
     13// Update Count     : 2
    1414//
    1515
     
    2626
    2727struct LinkTypesCore : public WithNoIdSymbolTable,
     28                public ast::WithCodeLocation,
    2829                public ast::WithGuards,
    29                 public ast::WithVisitorRef<LinkTypesCore>,
    30                 public ast::WithShortCircuiting {
    31 
     30                public ast::WithShortCircuiting,
     31                public ast::WithVisitorRef<LinkTypesCore> {
    3232        ast::TypeInstType const * postvisit( ast::TypeInstType const * type );
    3333        ast::EnumInstType const * postvisit( ast::EnumInstType const * type );
     
    3838        void postvisit( ast::QualifiedType const * type );
    3939
    40         void previsit( ast::ParseNode const * node );
    41 
    4240        ast::EnumDecl const * postvisit( ast::EnumDecl const * decl );
    4341        ast::StructDecl const * previsit( ast::StructDecl const * decl );
     
    6058        ForwardEnumsType forwardEnums;
    6159
    62         const CodeLocation * location = nullptr;
    6360        /// true if currently in a generic type body,
    6461        /// so that type parameter instances can be renamed appropriately
     
    177174        // Linking only makes sense for the 'oldest ancestor' of the qualified type.
    178175        type->parent->accept( *visitor );
    179 }
    180 
    181 void LinkTypesCore::previsit( ast::ParseNode const * node ) {
    182         GuardValue( location ) = &node->location;
    183176}
    184177
     
    225218        GuardValue( inGeneric ) = !decl->params.empty();
    226219        if ( !inGeneric ) {
    227                 GuardValue( location ) = &decl->location;
    228220                return decl;
    229221        }
    230222        auto mut = ast::mutate( decl );
    231         GuardValue( location ) = &mut->location;
    232223        for ( ast::ptr<ast::TypeDecl> & typeDecl : mut->params ) {
    233224                typeDecl.get_and_mutate()->name = "__" + typeDecl->name + "_generic_";
Note: See TracChangeset for help on using the changeset viewer.