Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Initializer.cc

    r50377a4 rd67cdb7  
    3838}
    3939
    40 void Designation::print( std::ostream &os, Indenter indent ) const {
     40void Designation::print( std::ostream &os, int indent ) const {
    4141        if ( ! designators.empty() ) {
    42                 os << "... designated by: " << std::endl;
    43                 for ( const Expression * d : designators ) {
    44                         os << indent+1;
    45                         d->print(os, indent+1 );
    46                         os << std::endl;
     42                os << std::string(indent + 2, ' ' ) << "designated by: " << std::endl;
     43                for ( std::list < Expression * >::const_iterator i = designators.begin(); i != designators.end(); i++ ) {
     44                        os << std::string(indent + 4, ' ' );
     45                        ( *i )->print(os, indent + 4 );
    4746                }
     47                os << std::endl;
    4848        } // if
    4949}
     
    6464}
    6565
    66 void SingleInit::print( std::ostream &os, Indenter indent ) const {
    67         os << "Simple Initializer: ";
    68         value->print( os, indent );
     66void SingleInit::print( std::ostream &os, int indent ) const {
     67        os << std::string(indent, ' ' ) << "Simple Initializer: " << std::endl;
     68        os << std::string(indent+4, ' ' );
     69        value->print( os, indent+4 );
    6970}
    7071
     
    9293}
    9394
    94 void ListInit::print( std::ostream &os, Indenter indent ) const {
    95         os << "Compound initializer: " << std::endl;
    96         for ( auto p : group_iterate( designations, initializers ) ) {
    97                 const Designation * d = std::get<0>(p);
    98                 const Initializer * init = std::get<1>(p);
    99                 os << indent+1;
    100                 init->print( os, indent+1 );
     95void ListInit::print( std::ostream &os, int indent ) const {
     96        os << std::string(indent, ' ') << "Compound initializer:  " << std::endl;
     97        for ( Designation * d : designations ) {
     98                d->print( os, indent + 2 );
     99        }
     100
     101        for ( const Initializer * init : initializers ) {
     102                init->print( os, indent + 2 );
    101103                os << std::endl;
    102                 if ( ! d->designators.empty() ) {
    103                         os << indent+1;
    104                         d->print( os, indent+1 );
    105                 }
    106104        }
    107105}
     
    118116}
    119117
    120 void ConstructorInit::print( std::ostream &os, Indenter indent ) const {
    121         os << "Constructor initializer: " << std::endl;
     118void ConstructorInit::print( std::ostream &os, int indent ) const {
     119        os << std::endl << std::string(indent, ' ') << "Constructor initializer: " << std::endl;
    122120        if ( ctor ) {
    123                 os << indent << "... initially constructed with ";
    124                 ctor->print( os, indent+1 );
     121                os << std::string(indent+2, ' ');
     122                os << "initially constructed with ";
     123                ctor->print( os, indent+4 );
    125124        } // if
    126125
    127126        if ( dtor ) {
    128                 os << indent << "... destructed with ";
    129                 dtor->print( os, indent+1 );
     127                os << std::string(indent+2, ' ');
     128                os << "destructed with ";
     129                dtor->print( os, indent+4 );
    130130        }
    131131
    132132        if ( init ) {
    133                 os << indent << "... with fallback C-style initializer: ";
    134                 init->print( os, indent+1 );
     133                os << std::string(indent+2, ' ');
     134                os << "with fallback C-style initializer: ";
     135                init->print( os, indent+4 );
    135136        }
    136137}
Note: See TracChangeset for help on using the changeset viewer.