Changeset 3b0bc16 for src/CodeGen


Ignore:
Timestamp:
Feb 1, 2022, 8:22:12 PM (4 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_

Location:
src/CodeGen
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r729c991 r3b0bc16  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 19:00:42 2021
    13 // Update Count     : 536
     12// Last Modified On : Tue Feb  1 16:29:25 2022
     13// Update Count     : 540
    1414//
    1515#include "CodeGenerator.h"
     
    4242        bool wantSpacing( Statement * stmt) {
    4343                return dynamic_cast< IfStmt * >( stmt ) || dynamic_cast< CompoundStmt * >( stmt ) ||
    44                         dynamic_cast< WhileStmt * >( stmt ) || dynamic_cast< ForStmt * >( stmt ) || dynamic_cast< SwitchStmt *>( stmt );
     44                        dynamic_cast< WhileDoStmt * >( stmt ) || dynamic_cast< ForStmt * >( stmt ) || dynamic_cast< SwitchStmt *>( stmt );
    4545        }
    4646
     
    955955                output << " ) ";
    956956
    957                 ifStmt->get_thenPart()->accept( *visitor );
    958 
    959                 if ( ifStmt->get_elsePart() != 0) {
     957                ifStmt->get_then()->accept( *visitor );
     958
     959                if ( ifStmt->get_else() != 0) {
    960960                        output << " else ";
    961                         ifStmt->get_elsePart()->accept( *visitor );
     961                        ifStmt->get_else()->accept( *visitor );
    962962                } // if
    963963        }
     
    11251125        }
    11261126
    1127         void CodeGenerator::postvisit( WhileStmt * whileStmt ) {
    1128                 if ( whileStmt->get_isDoWhile() ) {
     1127        void CodeGenerator::postvisit( WhileDoStmt * whileDoStmt ) {
     1128                if ( whileDoStmt->get_isDoWhile() ) {
    11291129                        output << "do";
    11301130                } else {
    11311131                        output << "while (";
    1132                         whileStmt->get_condition()->accept( *visitor );
     1132                        whileDoStmt->get_condition()->accept( *visitor );
    11331133                        output << ")";
    11341134                } // if
    11351135                output << " ";
    11361136
    1137                 output << CodeGenerator::printLabels( whileStmt->get_body()->get_labels() );
    1138                 whileStmt->get_body()->accept( *visitor );
     1137                output << CodeGenerator::printLabels( whileDoStmt->get_body()->get_labels() );
     1138                whileDoStmt->get_body()->accept( *visitor );
    11391139
    11401140                output << indent;
    11411141
    1142                 if ( whileStmt->get_isDoWhile() ) {
     1142                if ( whileDoStmt->get_isDoWhile() ) {
    11431143                        output << " while (";
    1144                         whileStmt->get_condition()->accept( *visitor );
     1144                        whileDoStmt->get_condition()->accept( *visitor );
    11451145                        output << ");";
    11461146                } // if
  • src/CodeGen/CodeGenerator.h

    r729c991 r3b0bc16  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 18:35:38 2021
    13 // Update Count     : 63
     12// Last Modified On : Tue Feb  1 09:23:21 2022
     13// Update Count     : 64
    1414//
    1515
     
    116116                void postvisit( WaitForStmt * );
    117117                void postvisit( WithStmt * );
    118                 void postvisit( WhileStmt * );
     118                void postvisit( WhileDoStmt * );
    119119                void postvisit( ForStmt * );
    120120                void postvisit( NullStmt * );
Note: See TracChangeset for help on using the changeset viewer.