Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.cc

    red34540 r1057e3d  
    272272        }
    273273
    274         NamedTypeDecl *Indexer::globalLookupType( const std::string &id ) const {
    275                 return lookupTypeAtScope( id, 0 );
    276         }
    277 
    278         StructDecl *Indexer::globalLookupStruct( const std::string &id ) const {
    279                 return lookupStructAtScope( id, 0 );
    280         }
    281 
    282         UnionDecl *Indexer::globalLookupUnion( const std::string &id ) const {
    283                 return lookupUnionAtScope( id, 0 );
    284         }
    285 
    286         EnumDecl *Indexer::globalLookupEnum( const std::string &id ) const {
    287                 return lookupEnumAtScope( id, 0 );
    288         }
    289 
    290274        EnumDecl *Indexer::lookupEnum( const std::string &id ) const {
    291275                if ( ! tables ) return 0;
     
    363347                if ( ! tables ) return 0;
    364348                if ( tables->scope < scope ) return 0;
    365                 if ( tables->scope > scope ) return tables->base.lookupTypeAtScope( id, scope );
    366349
    367350                TypeTable::const_iterator ret = tables->typeTable.find( id );
     
    372355                if ( ! tables ) return 0;
    373356                if ( tables->scope < scope ) return 0;
    374                 if ( tables->scope > scope ) return tables->base.lookupStructAtScope( id, scope );
    375357
    376358                StructTable::const_iterator ret = tables->structTable.find( id );
     
    381363                if ( ! tables ) return 0;
    382364                if ( tables->scope < scope ) return 0;
    383                 if ( tables->scope > scope ) return tables->base.lookupEnumAtScope( id, scope );
    384365
    385366                EnumTable::const_iterator ret = tables->enumTable.find( id );
     
    390371                if ( ! tables ) return 0;
    391372                if ( tables->scope < scope ) return 0;
    392                 if ( tables->scope > scope ) return tables->base.lookupUnionAtScope( id, scope );
    393373
    394374                UnionTable::const_iterator ret = tables->unionTable.find( id );
     
    399379                if ( ! tables ) return 0;
    400380                if ( tables->scope < scope ) return 0;
    401                 if ( tables->scope > scope ) return tables->base.lookupTraitAtScope( id, scope );
    402381
    403382                TraitTable::const_iterator ret = tables->traitTable.find( id );
     
    507486
    508487        bool addedTypeConflicts( NamedTypeDecl *existing, NamedTypeDecl *added ) {
    509                 if ( existing->base == nullptr ) {
     488                if ( existing->get_base() == 0 ) {
    510489                        return false;
    511                 } else if ( added->base == nullptr ) {
     490                } else if ( added->get_base() == 0 ) {
    512491                        return true;
    513492                } else {
    514                         assert( existing->base && added->base );
    515                         // typedef redeclarations are errors only if types are different
    516                         if ( ! ResolvExpr::typesCompatible( existing->base, added->base, Indexer() ) ) {
    517                                 SemanticError( added->location, "redeclaration of " + added->name );
    518                         }
    519                 }
    520                 // does not need to be added to the table if both existing and added have a base that are the same
    521                 return true;
     493                        SemanticError( added, "redeclaration of " );
     494                }
    522495        }
    523496
     
    526499                makeWritable();
    527500
    528                 const std::string &id = decl->name;
     501                const std::string &id = decl->get_name();
    529502                TypeTable::iterator existing = tables->typeTable.find( id );
    530503                if ( existing == tables->typeTable.end() ) {
     
    559532                makeWritable();
    560533
    561                 const std::string &id = decl->name;
     534                const std::string &id = decl->get_name();
    562535                StructTable::iterator existing = tables->structTable.find( id );
    563536                if ( existing == tables->structTable.end() ) {
     
    578551                makeWritable();
    579552
    580                 const std::string &id = decl->name;
     553                const std::string &id = decl->get_name();
    581554                EnumTable::iterator existing = tables->enumTable.find( id );
    582555                if ( existing == tables->enumTable.end() ) {
     
    602575                makeWritable();
    603576
    604                 const std::string &id = decl->name;
     577                const std::string &id = decl->get_name();
    605578                UnionTable::iterator existing = tables->unionTable.find( id );
    606579                if ( existing == tables->unionTable.end() ) {
     
    621594                makeWritable();
    622595
    623                 const std::string &id = decl->name;
     596                const std::string &id = decl->get_name();
    624597                TraitTable::iterator existing = tables->traitTable.find( id );
    625598                if ( existing == tables->traitTable.end() ) {
Note: See TracChangeset for help on using the changeset viewer.