Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Statement.cc

    r74d1804 r3be261a  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu May 12 13:33:18 2016
     12// Last Modified On : Wed Dec 09 14:09:34 2015
    1313// Update Count     : 54
    1414//
     
    4343
    4444void ExprStmt::print( std::ostream &os, int indent ) const {
    45         os << "Expression Statement:" << endl << std::string( indent + 2, ' ' );
     45        os << string( indent, ' ' ) << "Expression Statement:" << endl;
    4646        expr->print( os, indent + 2 );
    4747}
     
    110110
    111111void ReturnStmt::print( std::ostream &os, int indent ) const {
    112         os << string ( isThrow? "Throw":"Return" ) << " Statement, returning: ";
    113         if ( expr != 0 ) {
    114                 os << endl << string( indent+2, ' ' );
    115                 expr->print( os, indent + 2 );
    116         }
     112        os << std::string( indent, ' ' ) << string ( isThrow? "Throw":"Return" ) << " Statement, returning: ";
     113        if ( expr != 0 ) expr->print( os );
    117114        os << endl;
    118115}
     
    127124
    128125void IfStmt::print( std::ostream &os, int indent ) const {
    129         os << "If on condition: " << endl ;
    130         os << string( indent+4, ' ' );
     126        os << string( indent, ' ' ) << "If on condition: " << endl ;
    131127        condition->print( os, indent + 4 );
    132128
    133         os << string( indent+2, ' ' ) << "... then: " << endl;
    134 
    135         os << string( indent+4, ' ' );
     129        os << string( indent, ' ' ) << ".... and branches: " << endl;
     130
    136131        thenPart->print( os, indent + 4 );
    137132
    138133        if ( elsePart != 0 ) {
    139                 os << string( indent+2, ' ' ) << "... else: " << endl;
    140                 os << string( indent+4, ' ' );
    141134                elsePart->print( os, indent + 4 );
    142135        } // if
     
    160153
    161154void SwitchStmt::print( std::ostream &os, int indent ) const {
    162         os << "Switch on condition: ";
     155        os << string( indent, ' ' ) << "Switch on condition: ";
    163156        condition->print( os );
    164157        os << endl;
     
    225218
    226219void ChooseStmt::print( std::ostream &os, int indent ) const {
    227         os << "Choose on condition: ";
     220        os << string( indent, ' ' ) << "Choose on condition: ";
    228221        condition->print( os );
    229222        os << endl;
     
    254247
    255248void WhileStmt::print( std::ostream &os, int indent ) const {
    256         os << "While on condition: " << endl ;
     249        os << string( indent, ' ' ) << "While on condition: " << endl ;
    257250        condition->print( os, indent + 4 );
    258251
     
    280273
    281274void ForStmt::print( std::ostream &os, int indent ) const {
    282         os << "Labels: {";
     275        os << string( indent, ' ' ) << "Labels: {";
    283276        for ( std::list<Label>::const_iterator it = get_labels().begin(); it != get_labels().end(); ++it) {
    284277                os << *it << ",";
     
    290283        os << string( indent + 2, ' ' ) << "initialization: \n";
    291284        for ( std::list<Statement *>::const_iterator it = initialization.begin(); it != initialization.end(); ++it ) {
    292                 os << string( indent + 4, ' ' );
    293285                (*it)->print( os, indent + 4 );
    294286        }
    295287
    296288        os << "\n" << string( indent + 2, ' ' ) << "condition: \n";
    297         if ( condition != 0 ) {
    298                 os << string( indent + 4, ' ' );
     289        if ( condition != 0 )
    299290                condition->print( os, indent + 4 );
    300         }
    301291
    302292        os << "\n" << string( indent + 2, ' ' ) << "increment: \n";
    303         if ( increment != 0 ) {
    304                 os << string( indent + 4, ' ' );
     293        if ( increment != 0 )
    305294                increment->print( os, indent + 4 );
    306         }
    307295
    308296        os << "\n" << string( indent + 2, ' ' ) << "statement block: \n";
    309         if ( body != 0 ) {
    310                 os << string( indent + 4, ' ' );
     297        if ( body != 0 )
    311298                body->print( os, indent + 4 );
    312         }
    313299
    314300        os << endl;
     
    328314
    329315void TryStmt::print( std::ostream &os, int indent ) const {
    330         os << "Try Statement" << endl;
     316        os << string( indent, ' ' ) << "Try Statement" << endl;
    331317        os << string( indent + 2, ' ' ) << "with block: " << endl;
    332318        block->print( os, indent + 4 );
     
    358344
    359345void CatchStmt::print( std::ostream &os, int indent ) const {
    360         os << "Catch Statement" << endl;
     346        os << string( indent, ' ' ) << "Catch Statement" << endl;
    361347
    362348        os << string( indent, ' ' ) << "... catching" << endl;
     
    383369
    384370void FinallyStmt::print( std::ostream &os, int indent ) const {
    385         os << "Finally Statement" << endl;
     371        os << string( indent, ' ' ) << "Finally Statement" << endl;
    386372        os << string( indent + 2, ' ' ) << "with block: " << endl;
    387373        block->print( os, indent + 4 );
     
    392378
    393379void NullStmt::print( std::ostream &os, int indent ) const {
    394         os << "Null Statement" << endl ;
    395 }
    396 
    397 ImplicitCtorDtorStmt::ImplicitCtorDtorStmt( Statement * callStmt ) : Statement( std::list<Label>() ), callStmt( callStmt ) {
    398         assert( callStmt );
    399 }
    400 
    401 ImplicitCtorDtorStmt::ImplicitCtorDtorStmt( const ImplicitCtorDtorStmt & other ) : Statement( other ), callStmt( maybeClone( other.callStmt ) ) {
    402 }
    403 
    404 ImplicitCtorDtorStmt::~ImplicitCtorDtorStmt() {
    405         delete callStmt;
    406 }
    407 
    408 void ImplicitCtorDtorStmt::print( std::ostream &os, int indent ) const {
    409         os << "Implicit Ctor Dtor Statement" << endl;
    410         os << string( indent + 2, ' ' ) << "with Ctor/Dtor: ";
    411         callStmt->print( os, indent + 2);
    412         os << endl;
     380        os << string( indent, ' ' ) << "Null Statement" << endl ;
    413381}
    414382
Note: See TracChangeset for help on using the changeset viewer.