Changeset 81644e0 for src/SymTab


Ignore:
Timestamp:
Dec 1, 2017, 2:51:50 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
55d6e8de
Parents:
373d0b5
Message:

Add Indexer::addWith to insert with expression members into current scope

Location:
src/SymTab
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.cc

    r373d0b5 r81644e0  
    567567        }
    568568
     569        void Indexer::addWith( WithStmt * stmt ) {
     570                for ( Expression * expr : stmt->exprs ) {
     571                        if ( expr->result ) {
     572                                AggregateDecl * aggr = expr->result->getAggr();
     573                                assertf( aggr, "WithStmt expr has non-aggregate type: %s", toString( expr->result ).c_str() );
     574
     575                                // xxx - this is wrong, needs to somehow hook up chain of objects
     576                                for ( Declaration * decl : aggr->members ) {
     577                                        if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) {
     578                                                addId( dwt );
     579                                        }
     580                                }
     581                        }
     582                }
     583        }
     584
    569585        void Indexer::addIds( const std::list< DeclarationWithType * > & decls ) {
    570586                for ( auto d : decls ) {
  • src/SymTab/Indexer.h

    r373d0b5 r81644e0  
    7676                void addTrait( TraitDecl *decl );
    7777
     78                /// adds all of the IDs from WithStmt exprs
     79                void addWith( WithStmt * );
     80
    7881                /// convenience function for adding a list of Ids to the indexer
    7982                void addIds( const std::list< DeclarationWithType * > & decls );
Note: See TracChangeset for help on using the changeset viewer.