Changeset 1485c1a
- Timestamp:
- Dec 7, 2017, 5:06:28 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 87959f6
- Parents:
- 5e1adb5
- Location:
- src/SymTab
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
r5e1adb5 r1485c1a 572 572 } 573 573 574 void Indexer::addMembers( AggregateDecl * aggr, Expression * expr ) { 575 for ( Declaration * decl : aggr->members ) { 576 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) { 577 addId( dwt, expr ); 578 if ( dwt->name == "" ) { 579 Type * t = dwt->get_type()->stripReferences(); 580 if ( dynamic_cast< StructInstType * >( t ) || dynamic_cast< UnionInstType * >( t ) ) { 581 Expression * base = expr->clone(); 582 ResolvExpr::referenceToRvalueConversion( base ); 583 addMembers( t->getAggr(), new MemberExpr( dwt, base ) ); 584 } 585 } 586 } 587 } 588 } 589 574 590 void Indexer::addWith( WithStmt * stmt ) { 575 591 for ( Expression * expr : stmt->exprs ) { … … 578 594 assertf( aggr, "WithStmt expr has non-aggregate type: %s", toString( expr->result ).c_str() ); 579 595 580 for ( Declaration * decl : aggr->members ) { 581 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) { 582 addId( dwt, expr ); 583 } 584 } 596 addMembers( aggr, expr ); 585 597 } 586 598 } -
src/SymTab/Indexer.h
r5e1adb5 r1485c1a 86 86 void addWith( WithStmt * ); 87 87 88 /// adds all of the members of the Aggregate (addWith helper) 89 void addMembers( AggregateDecl * aggr, Expression * expr ); 90 88 91 /// convenience function for adding a list of Ids to the indexer 89 92 void addIds( const std::list< DeclarationWithType * > & decls );
Note: See TracChangeset
for help on using the changeset viewer.