Changeset 3f27b9a


Ignore:
Timestamp:
Aug 15, 2017, 3:03:34 PM (4 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
fcc88a4
Parents:
c6c6f2ae
Message:

Fix scoping issues for CatchStmt?

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    rc6c6f2ae r3f27b9a  
    394394
    395395        void Resolver::visit( CatchStmt *catchStmt ) {
    396                 Parent::visit( catchStmt );
     396                // inline Indexer::visit so that the exception variable is still in-scope for
     397                // findSingleExpression() below
     398                Parent::enterScope();
     399                Visitor::visit( catchStmt );
    397400               
    398401                if ( catchStmt->get_cond() ) {
     
    403406                        catchStmt->set_cond( findSingleExpression( wrapped, *this ) );
    404407                }
     408
     409                Parent::leaveScope();
    405410        }
    406411
  • src/SymTab/Indexer.cc

    rc6c6f2ae r3f27b9a  
    353353        }
    354354
     355        void Indexer::visit( ForStmt *forStmt ) {
     356            // for statements introduce a level of scope
     357            enterScope();
     358            Visitor::visit( forStmt );
     359            leaveScope();
     360        }
     361
     362        void Indexer::visit( CatchStmt *catchStmt ) {
     363                // catch statements introduce a level of scope (for the caught exception)
     364                enterScope();
     365                Visitor::visit( catchStmt );
     366                leaveScope();
     367        }
    355368
    356369        void Indexer::visit( ApplicationExpr *applicationExpr ) {
     
    556569                leaveScope();
    557570        }
    558 
    559         void Indexer::visit( ForStmt *forStmt ) {
    560             // for statements introduce a level of scope
    561             enterScope();
    562             Visitor::visit( forStmt );
    563             leaveScope();
    564         }
    565 
    566 
    567571
    568572        void Indexer::lookupId( const std::string &id, std::list< DeclarationWithType* > &out ) const {
  • src/SymTab/Indexer.h

    rc6c6f2ae r3f27b9a  
    4545
    4646                virtual void visit( CompoundStmt *compoundStmt );
     47                virtual void visit( ForStmt *forStmt );
     48                virtual void visit( CatchStmt *catchStmt );
    4749
    4850                virtual void visit( ApplicationExpr *applicationExpr );
     
    8183                virtual void visit( StructInstType *contextInst );
    8284                virtual void visit( UnionInstType *contextInst );
    83 
    84                 virtual void visit( ForStmt *forStmt );
    8585
    8686                // when using an indexer manually (e.g., within a mutator traversal), it is necessary to tell the indexer
Note: See TracChangeset for help on using the changeset viewer.