Ignore:
Timestamp:
May 17, 2023, 1:33:39 AM (12 months ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT
Children:
d6c464d
Parents:
28f8f15
Message:

Save progress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/SymbolTable.cpp

    r28f8f15 r561354f  
    358358}
    359359
     360void SymbolTable::addAdt( const AdtDecl *decl ) {
     361        ++*stats().add_calls;
     362        const std::string &id = decl->name;
     363
     364        if ( ! adtTable ) {
     365                adtTable = AdtTable::new_ptr();
     366        } else {
     367                ++*stats().map_lookups;
     368                auto existing = adtTable->find( id );
     369                if ( existing != adtTable->end()
     370                        && existing->second.scope == scope
     371                        && addedDeclConflicts( existing->second.decl, decl ) ) return;
     372       
     373        }
     374
     375        lazyInitScope();
     376        ++*stats().map_mutations;
     377        adtTable = adtTable->set( id, scoped<AdtDecl>{ decl, scope });
     378}
     379
    360380void SymbolTable::addUnion( const std::string &id ) {
    361381        addUnion( new UnionDecl( CodeLocation(), id ) );
Note: See TracChangeset for help on using the changeset viewer.