Ignore:
Timestamp:
Apr 26, 2016, 12:55:40 PM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
60089f4, 668edd6b
Parents:
dc5376a
Message:

fix printing for various AST nodes, including ObjectDecl, ExprStmt, etc. - assume preceding indentation printed by parent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    rdc5376a r89231bc  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Apr  8 17:16:23 2016
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Apr 26 12:52:40 2016
    1313// Update Count     : 40
    1414//
     
    9393
    9494void VariableExpr::print( std::ostream &os, int indent ) const {
    95         os << std::string( indent, ' ' ) << "Variable Expression: ";
     95        os << "Variable Expression: ";
    9696
    9797        Declaration *decl = get_var();
     
    122122
    123123void SizeofExpr::print( std::ostream &os, int indent) const {
    124         os << std::string( indent, ' ' ) << "Sizeof Expression on: ";
     124        os << "Sizeof Expression on: ";
    125125
    126126        if (isType)
     
    295295
    296296void CastExpr::print( std::ostream &os, int indent ) const {
    297         os << std::string( indent, ' ' ) << "Cast of:" << std::endl;
     297        os << "Cast of:" << std::endl << std::string( indent+2, ' ' );
    298298        arg->print(os, indent+2);
    299299        os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl;
     
    318318
    319319void UntypedMemberExpr::print( std::ostream &os, int indent ) const {
    320         os << std::string( indent, ' ' ) << "Member Expression, with field: " << get_member();
     320        os << "Untyped Member Expression, with field: " << get_member();
    321321
    322322        Expression *agg = get_aggregate();
    323323        os << std::string( indent, ' ' ) << "from aggregate: ";
    324         if (agg != 0) agg->print(os, indent + 2);
     324        if (agg != 0) {
     325                os << std::string( indent+2, ' ' );
     326                agg->print(os, indent + 2);
     327        }
     328        os << std::string( indent+2, ' ' );
    325329        Expression::print( os, indent );
    326330}
     
    345349
    346350void MemberExpr::print( std::ostream &os, int indent ) const {
    347         os << std::string( indent, ' ' ) << "Member Expression, with field: " << std::endl;
     351        os << "Member Expression, with field: " << std::endl;
    348352
    349353        assert( member );
     
    354358        Expression *agg = get_aggregate();
    355359        os << std::string( indent, ' ' ) << "from aggregate: " << std::endl;
    356         if (agg != 0) agg->print(os, indent + 2);
     360        if (agg != 0) {
     361                os << std::string( indent+2, ' ' );
     362                agg->print(os, indent + 2);
     363        }
     364        os << std::string( indent+2, ' ' );
    357365        Expression::print( os, indent );
    358366}
     
    372380
    373381void UntypedExpr::print( std::ostream &os, int indent ) const {
    374         os << std::string( indent, ' ' ) << "Applying untyped: " << std::endl;
     382        os << "Applying untyped: " << std::endl;
     383        os << std::string( indent, ' ' );
    375384        function->print(os, indent + 4);
    376385        os << std::string( indent, ' ' ) << "...to: " << std::endl;
     386        os << std::string( indent, ' ' );
    377387        printArgs(os, indent + 4);
    378388        Expression::print( os, indent );
     
    393403
    394404void NameExpr::print( std::ostream &os, int indent ) const {
    395         os << std::string( indent, ' ' ) << "Name: " << get_name() << std::endl;
     405        os << "Name: " << get_name() << std::endl;
    396406        Expression::print( os, indent );
    397407}
Note: See TracChangeset for help on using the changeset viewer.