Changeset fca3bf8 for src


Ignore:
Timestamp:
Feb 18, 2020, 8:52:55 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
e326ebca
Parents:
6988dc6 (diff), 3b9c674 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    r6988dc6 rfca3bf8  
    8484                void previsit( ThrowStmt * throwStmt );
    8585                void previsit( CatchStmt * catchStmt );
     86                void postvisit( CatchStmt * catchStmt );
    8687                void previsit( WaitForStmt * stmt );
    8788
     
    567568
    568569        void Resolver_old::previsit( CatchStmt * catchStmt ) {
     570                // Until we are very sure this invarent (ifs that move between passes have thenPart)
     571                // holds, check it. This allows a check for when to decode the mangling.
     572                if ( IfStmt * ifStmt = dynamic_cast<IfStmt *>( catchStmt->body ) ) {
     573                        assert( ifStmt->thenPart );
     574                }
     575                // Encode the catchStmt so the condition can see the declaration.
    569576                if ( catchStmt->cond ) {
    570                         findSingleExpression( catchStmt->cond, new BasicType( noQualifiers, BasicType::Bool ), indexer );
     577                        IfStmt * ifStmt = new IfStmt( catchStmt->cond, nullptr, catchStmt->body );
     578                        catchStmt->cond = nullptr;
     579                        catchStmt->body = ifStmt;
     580                }
     581        }
     582
     583        void Resolver_old::postvisit( CatchStmt * catchStmt ) {
     584                // Decode the catchStmt so everything is stored properly.
     585                IfStmt * ifStmt = dynamic_cast<IfStmt *>( catchStmt->body );
     586                if ( nullptr != ifStmt && nullptr == ifStmt->thenPart ) {
     587                        assert( ifStmt->condition );
     588                        assert( ifStmt->elsePart );
     589                        catchStmt->cond = ifStmt->condition;
     590                        catchStmt->body = ifStmt->elsePart;
     591                        ifStmt->condition = nullptr;
     592                        ifStmt->elsePart = nullptr;
     593                        delete ifStmt;
    571594                }
    572595        }
     
    14661489
    14671490        const ast::CatchStmt * Resolver_new::previsit( const ast::CatchStmt * catchStmt ) {
     1491                // TODO: This will need a fix for the decl/cond scoping problem.
    14681492                if ( catchStmt->cond ) {
    14691493                        ast::ptr< ast::Type > boolType = new ast::BasicType{ ast::BasicType::Bool };
Note: See TracChangeset for help on using the changeset viewer.