Ignore:
Timestamp:
Aug 14, 2017, 2:44:40 PM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
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:
6a36975
Parents:
bd46af4
Message:

Working on exception related readablility.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Statement.cc

    rbd46af4 r406a6e6  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jun 12 10:37:00 2017
    13 // Update Count     : 64
     12// Last Modified On : Mon Aug 14 12:26:00 2017
     13// Update Count     : 65
    1414//
    1515
     
    329329void TryStmt::print( std::ostream &os, int indent ) const {
    330330        os << "Try Statement" << endl;
    331         os << string( indent + 2, ' ' ) << "with block: " << endl;
     331        os << string( indent + 2, ' ' ) << "with block:" << endl;
     332        os << string( indent + 4, ' ' );
    332333        block->print( os, indent + 4 );
    333334
    334335        // handlers
    335         os << string( indent + 2, ' ' ) << "and handlers: " << endl;
    336         for ( std::list<CatchStmt *>::const_iterator i = handlers.begin(); i != handlers.end(); i++)
     336        os << string( indent + 2, ' ' ) << "and handlers:" << endl;
     337        for ( std::list<CatchStmt *>::const_iterator i = handlers.begin(); i != handlers.end(); i++) {
     338                os << string( indent + 4, ' ' );
    337339                (*i )->print( os, indent + 4 );
     340        }
    338341
    339342        // finally block
    340343        if ( finallyBlock != 0 ) {
    341                 os << string( indent + 2, ' ' ) << "Finally block: " << endl;
     344                os << string( indent + 2, ' ' ) << "and finally:" << endl;
    342345                finallyBlock->print( os, indent + 4 );
    343346        } // if
     
    360363        os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << " Statement" << endl;
    361364
    362         os << string( indent, ' ' ) << "... catching" << endl;
     365        os << string( indent + 2, ' ' ) << "... catching: ";
    363366        if ( decl ) {
    364367                decl->printShort( os, indent + 4 );
     
    367370        else
    368371                os << string( indent + 4 , ' ' ) << ">>> Error:  this catch clause must have a declaration <<<" << endl;
     372
     373        if ( cond ) {
     374                os << string( indent + 2, ' ' ) << "with conditional:" << endl;
     375                os << string( indent + 4, ' ' );
     376                cond->print( os, indent + 4 );
     377        }
     378        else
     379                os << string( indent + 2, ' ' ) << "with no conditional" << endl;
     380
     381        os << string( indent + 2, ' ' ) << "with block:" << endl;
     382        os << string( indent + 4, ' ' );
     383        body->print( os, indent + 4 );
    369384}
    370385
     
    383398void FinallyStmt::print( std::ostream &os, int indent ) const {
    384399        os << "Finally Statement" << endl;
    385         os << string( indent + 2, ' ' ) << "with block: " << endl;
     400        os << string( indent + 2, ' ' ) << "with block:" << endl;
     401        os << string( indent + 4, ' ' );
    386402        block->print( os, indent + 4 );
    387403}
Note: See TracChangeset for help on using the changeset viewer.