Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    rbb8ea30 r630a82a  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Fri May 13 13:19:09 2016
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Apr  8 17:16:23 2016
    1313// Update Count     : 40
    1414//
     
    7272
    7373void ConstantExpr::print( std::ostream &os, int indent ) const {
    74         os << "constant expression " ;
     74        os << std::string( indent, ' ' ) << "constant expression " ;
    7575        constant.print( os );
    7676        Expression::print( os, indent );
     77        os << std::endl;
    7778}
    7879
     
    9293
    9394void VariableExpr::print( std::ostream &os, int indent ) const {
    94         os << "Variable Expression: ";
     95        os << std::string( indent, ' ' ) << "Variable Expression: ";
    9596
    9697        Declaration *decl = get_var();
     
    121122
    122123void SizeofExpr::print( std::ostream &os, int indent) const {
    123         os << "Sizeof Expression on: ";
     124        os << std::string( indent, ' ' ) << "Sizeof Expression on: ";
    124125
    125126        if (isType)
     
    222223}
    223224
    224 OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) {
    225         add_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
    226 }
    227 
    228 OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {}
    229 
    230 OffsetPackExpr::~OffsetPackExpr() { delete type; }
    231 
    232 void OffsetPackExpr::print( std::ostream &os, int indent ) const {
    233         os << std::string( indent, ' ' ) << "Offset pack expression on ";
    234 
    235         if ( type ) {
    236                 type->print(os, indent + 2);
    237         } else {
    238                 os << "<NULL>";
    239         }
    240 
    241         os << std::endl;
    242         Expression::print( os, indent );
    243 }
    244 
    245225AttrExpr::AttrExpr( Expression *attr, Expression *expr_, Expression *_aname ) :
    246226                Expression( _aname ), attr( attr ), expr(expr_), type(0), isType(false) {
     
    294274
    295275void CastExpr::print( std::ostream &os, int indent ) const {
    296         os << "Cast of:" << std::endl << std::string( indent+2, ' ' );
     276        os << std::string( indent, ' ' ) << "Cast of:" << std::endl;
    297277        arg->print(os, indent+2);
    298278        os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl;
     
    317297
    318298void UntypedMemberExpr::print( std::ostream &os, int indent ) const {
    319         os << "Untyped Member Expression, with field: " << get_member();
     299        os << std::string( indent, ' ' ) << "Member Expression, with field: " << get_member();
    320300
    321301        Expression *agg = get_aggregate();
    322         os << ", from aggregate: ";
    323         if (agg != 0) {
    324                 os << std::string( indent + 2, ' ' );
    325                 agg->print(os, indent + 2);
    326         }
    327         os << std::string( indent+2, ' ' );
     302        os << std::string( indent, ' ' ) << "from aggregate: ";
     303        if (agg != 0) agg->print(os, indent + 2);
    328304        Expression::print( os, indent );
    329305}
     
    348324
    349325void MemberExpr::print( std::ostream &os, int indent ) const {
    350         os << "Member Expression, with field: " << std::endl;
     326        os << std::string( indent, ' ' ) << "Member Expression, with field: " << std::endl;
    351327
    352328        assert( member );
     
    357333        Expression *agg = get_aggregate();
    358334        os << std::string( indent, ' ' ) << "from aggregate: " << std::endl;
    359         if (agg != 0) {
    360                 os << std::string( indent + 2, ' ' );
    361                 agg->print(os, indent + 2);
    362         }
    363         os << std::string( indent+2, ' ' );
     335        if (agg != 0) agg->print(os, indent + 2);
    364336        Expression::print( os, indent );
    365337}
     
    379351
    380352void UntypedExpr::print( std::ostream &os, int indent ) const {
    381         os << "Applying untyped: " << std::endl;
    382         os << std::string( indent+2, ' ' );
    383         function->print(os, indent + 2);
     353        os << std::string( indent, ' ' ) << "Applying untyped: " << std::endl;
     354        function->print(os, indent + 4);
    384355        os << std::string( indent, ' ' ) << "...to: " << std::endl;
    385         printAll(args, os, indent + 2);
     356        printArgs(os, indent + 4);
    386357        Expression::print( os, indent );
    387358}
     
    389360void UntypedExpr::printArgs( std::ostream &os, int indent ) const {
    390361        std::list<Expression *>::const_iterator i;
    391         for (i = args.begin(); i != args.end(); i++) {
    392                 os << std::string(indent, ' ' );
     362        for (i = args.begin(); i != args.end(); i++)
    393363                (*i)->print(os, indent);
    394         }
    395364}
    396365
     
    403372
    404373void NameExpr::print( std::ostream &os, int indent ) const {
    405         os << "Name: " << get_name() << std::endl;
     374        os << std::string( indent, ' ' ) << "Name: " << get_name() << std::endl;
    406375        Expression::print( os, indent );
    407376}
Note: See TracChangeset for help on using the changeset viewer.