Changeset 3b0bc16 for src/ResolvExpr


Ignore:
Timestamp:
Feb 1, 2022, 8:22:12 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
fde0a58
Parents:
729c991
Message:

change class name WhileStmt? to WhileDoStmt?, add else clause to WhileDoStmt? and ForStmt?, change names thenPart/ElsePart to then/else_

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    r729c991 r3b0bc16  
    99// Author           : Aaron B. Moss
    1010// Created On       : Sun May 17 12:17:01 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Mar 27 11:58:00 2020
    13 // Update Count     : 242
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Feb  1 16:27:14 2022
     13// Update Count     : 245
    1414//
    1515
     
    8080                void previsit( AsmStmt * asmStmt );
    8181                void previsit( IfStmt * ifStmt );
    82                 void previsit( WhileStmt * whileStmt );
     82                void previsit( WhileDoStmt * whileDoStmt );
    8383                void previsit( ForStmt * forStmt );
    8484                void previsit( SwitchStmt * switchStmt );
     
    502502        }
    503503
    504         void Resolver_old::previsit( WhileStmt * whileStmt ) {
    505                 findIntegralExpression( whileStmt->condition, indexer );
     504        void Resolver_old::previsit( WhileDoStmt * whileDoStmt ) {
     505                findIntegralExpression( whileDoStmt->condition, indexer );
    506506        }
    507507
     
    572572
    573573        void Resolver_old::previsit( CatchStmt * catchStmt ) {
    574                 // Until we are very sure this invarent (ifs that move between passes have thenPart)
     574                // Until we are very sure this invarent (ifs that move between passes have then)
    575575                // holds, check it. This allows a check for when to decode the mangling.
    576576                if ( IfStmt * ifStmt = dynamic_cast<IfStmt *>( catchStmt->body ) ) {
    577                         assert( ifStmt->thenPart );
     577                        assert( ifStmt->then );
    578578                }
    579579                // Encode the catchStmt so the condition can see the declaration.
     
    588588                // Decode the catchStmt so everything is stored properly.
    589589                IfStmt * ifStmt = dynamic_cast<IfStmt *>( catchStmt->body );
    590                 if ( nullptr != ifStmt && nullptr == ifStmt->thenPart ) {
     590                if ( nullptr != ifStmt && nullptr == ifStmt->then ) {
    591591                        assert( ifStmt->condition );
    592                         assert( ifStmt->elsePart );
     592                        assert( ifStmt->else_ );
    593593                        catchStmt->cond = ifStmt->condition;
    594                         catchStmt->body = ifStmt->elsePart;
     594                        catchStmt->body = ifStmt->else_;
    595595                        ifStmt->condition = nullptr;
    596                         ifStmt->elsePart = nullptr;
     596                        ifStmt->else_ = nullptr;
    597597                        delete ifStmt;
    598598                }
     
    12721272                const ast::AsmStmt *         previsit( const ast::AsmStmt * );
    12731273                const ast::IfStmt *          previsit( const ast::IfStmt * );
    1274                 const ast::WhileStmt *       previsit( const ast::WhileStmt * );
     1274                const ast::WhileDoStmt *       previsit( const ast::WhileDoStmt * );
    12751275                const ast::ForStmt *         previsit( const ast::ForStmt * );
    12761276                const ast::SwitchStmt *      previsit( const ast::SwitchStmt * );
     
    15811581        }
    15821582
    1583         const ast::WhileStmt * Resolver_new::previsit( const ast::WhileStmt * whileStmt ) {
     1583        const ast::WhileDoStmt * Resolver_new::previsit( const ast::WhileDoStmt * whileDoStmt ) {
    15841584                return ast::mutate_field(
    1585                         whileStmt, &ast::WhileStmt::cond, findIntegralExpression( whileStmt->cond, symtab ) );
     1585                        whileDoStmt, &ast::WhileDoStmt::cond, findIntegralExpression( whileDoStmt->cond, symtab ) );
    15861586        }
    15871587
     
    16691669
    16701670        const ast::CatchStmt * Resolver_new::previsit( const ast::CatchStmt * catchStmt ) {
    1671                 // Until we are very sure this invarent (ifs that move between passes have thenPart)
     1671                // Until we are very sure this invarent (ifs that move between passes have then)
    16721672                // holds, check it. This allows a check for when to decode the mangling.
    16731673                if ( auto ifStmt = catchStmt->body.as<ast::IfStmt>() ) {
    1674                         assert( ifStmt->thenPart );
     1674                        assert( ifStmt->then );
    16751675                }
    16761676                // Encode the catchStmt so the condition can see the declaration.
     
    16871687                // Decode the catchStmt so everything is stored properly.
    16881688                const ast::IfStmt * ifStmt = catchStmt->body.as<ast::IfStmt>();
    1689                 if ( nullptr != ifStmt && nullptr == ifStmt->thenPart ) {
     1689                if ( nullptr != ifStmt && nullptr == ifStmt->then ) {
    16901690                        assert( ifStmt->cond );
    1691                         assert( ifStmt->elsePart );
     1691                        assert( ifStmt->else_ );
    16921692                        ast::CatchStmt * stmt = ast::mutate( catchStmt );
    16931693                        stmt->cond = ifStmt->cond;
    1694                         stmt->body = ifStmt->elsePart;
     1694                        stmt->body = ifStmt->else_;
    16951695                        // ifStmt should be implicately deleted here.
    16961696                        return stmt;
Note: See TracChangeset for help on using the changeset viewer.