Ignore:
Timestamp:
Oct 2, 2017, 4:39:42 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
bf4b4cf
Parents:
a8555c5
Message:

Refactor tree print code to use Indenter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/FunctionDecl.cc

    ra8555c5 r50377a4  
    6363}
    6464
    65 void FunctionDecl::print( std::ostream &os, int indent ) const {
     65void FunctionDecl::print( std::ostream &os, Indenter indent ) const {
    6666        using std::endl;
    6767        using std::string;
    6868
    69         if ( get_name() != "" ) {
    70                 os << get_name() << ": ";
     69        if ( name != "" ) {
     70                os << name << ": ";
    7171        } // if
    72         if ( get_linkage() != LinkageSpec::Cforall ) {
    73                 os << LinkageSpec::linkageName( get_linkage() ) << " ";
     72        if ( linkage != LinkageSpec::Cforall ) {
     73                os << LinkageSpec::linkageName( linkage ) << " ";
    7474        } // if
    7575
    76         printAll( get_attributes(), os, indent );
     76        printAll( attributes, os, indent );
    7777
    7878        get_storageClasses().print( os );
    7979        get_funcSpec().print( os );
    8080
    81         if ( get_type() ) {
    82                 get_type()->print( os, indent );
     81        if ( type ) {
     82                type->print( os, indent );
    8383        } else {
    8484                os << "untyped entity ";
     
    8686
    8787        if ( statements ) {
    88                 os << string( indent + 2, ' ' ) << "with body " << endl;
    89                 os << string( indent + 4, ' ' );
    90                 statements->print( os, indent + 4 );
     88                os << indent << "... with body " << endl << indent+1;
     89                statements->print( os, indent+1 );
    9190        } // if
    9291}
    9392
    94 void FunctionDecl::printShort( std::ostream &os, int indent ) const {
     93void FunctionDecl::printShort( std::ostream &os, Indenter indent ) const {
    9594        using std::endl;
    9695        using std::string;
    9796
    98         if ( get_name() != "" ) {
    99                 os << get_name() << ": ";
     97        if ( name != "" ) {
     98                os << name << ": ";
    10099        } // if
    101 
    102         // xxx - should printShort print attributes?
    103100
    104101        get_storageClasses().print( os );
    105102        get_funcSpec().print( os );
    106103
    107         if ( get_type() ) {
    108                 get_type()->print( os, indent );
     104        if ( type ) {
     105                type->print( os, indent );
    109106        } else {
    110107                os << "untyped entity ";
Note: See TracChangeset for help on using the changeset viewer.