Changes in src/SymTab/Indexer.cc [ed34540:1057e3d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
red34540 r1057e3d 272 272 } 273 273 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 290 274 EnumDecl *Indexer::lookupEnum( const std::string &id ) const { 291 275 if ( ! tables ) return 0; … … 363 347 if ( ! tables ) return 0; 364 348 if ( tables->scope < scope ) return 0; 365 if ( tables->scope > scope ) return tables->base.lookupTypeAtScope( id, scope );366 349 367 350 TypeTable::const_iterator ret = tables->typeTable.find( id ); … … 372 355 if ( ! tables ) return 0; 373 356 if ( tables->scope < scope ) return 0; 374 if ( tables->scope > scope ) return tables->base.lookupStructAtScope( id, scope );375 357 376 358 StructTable::const_iterator ret = tables->structTable.find( id ); … … 381 363 if ( ! tables ) return 0; 382 364 if ( tables->scope < scope ) return 0; 383 if ( tables->scope > scope ) return tables->base.lookupEnumAtScope( id, scope );384 365 385 366 EnumTable::const_iterator ret = tables->enumTable.find( id ); … … 390 371 if ( ! tables ) return 0; 391 372 if ( tables->scope < scope ) return 0; 392 if ( tables->scope > scope ) return tables->base.lookupUnionAtScope( id, scope );393 373 394 374 UnionTable::const_iterator ret = tables->unionTable.find( id ); … … 399 379 if ( ! tables ) return 0; 400 380 if ( tables->scope < scope ) return 0; 401 if ( tables->scope > scope ) return tables->base.lookupTraitAtScope( id, scope );402 381 403 382 TraitTable::const_iterator ret = tables->traitTable.find( id ); … … 507 486 508 487 bool addedTypeConflicts( NamedTypeDecl *existing, NamedTypeDecl *added ) { 509 if ( existing-> base == nullptr) {488 if ( existing->get_base() == 0 ) { 510 489 return false; 511 } else if ( added-> base == nullptr) {490 } else if ( added->get_base() == 0 ) { 512 491 return true; 513 492 } 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 } 522 495 } 523 496 … … 526 499 makeWritable(); 527 500 528 const std::string &id = decl-> name;501 const std::string &id = decl->get_name(); 529 502 TypeTable::iterator existing = tables->typeTable.find( id ); 530 503 if ( existing == tables->typeTable.end() ) { … … 559 532 makeWritable(); 560 533 561 const std::string &id = decl-> name;534 const std::string &id = decl->get_name(); 562 535 StructTable::iterator existing = tables->structTable.find( id ); 563 536 if ( existing == tables->structTable.end() ) { … … 578 551 makeWritable(); 579 552 580 const std::string &id = decl-> name;553 const std::string &id = decl->get_name(); 581 554 EnumTable::iterator existing = tables->enumTable.find( id ); 582 555 if ( existing == tables->enumTable.end() ) { … … 602 575 makeWritable(); 603 576 604 const std::string &id = decl-> name;577 const std::string &id = decl->get_name(); 605 578 UnionTable::iterator existing = tables->unionTable.find( id ); 606 579 if ( existing == tables->unionTable.end() ) { … … 621 594 makeWritable(); 622 595 623 const std::string &id = decl-> name;596 const std::string &id = decl->get_name(); 624 597 TraitTable::iterator existing = tables->traitTable.find( id ); 625 598 if ( existing == tables->traitTable.end() ) {
Note:
See TracChangeset
for help on using the changeset viewer.