Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    r4ffdd63 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 : Wed Apr 27 17:07:19 2016
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Apr  8 17:16:23 2016
    1313// Update Count     : 40
    1414//
     
    7979
    8080VariableExpr::VariableExpr( DeclarationWithType *_var, Expression *_aname ) : Expression( _aname ), var( _var ) {
    81         assert( var );
    82         assert( var->get_type() );
    8381        add_result( var->get_type()->clone() );
    8482        for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) {
     
    9593
    9694void VariableExpr::print( std::ostream &os, int indent ) const {
    97         os << "Variable Expression: ";
     95        os << std::string( indent, ' ' ) << "Variable Expression: ";
    9896
    9997        Declaration *decl = get_var();
     
    124122
    125123void SizeofExpr::print( std::ostream &os, int indent) const {
    126         os << "Sizeof Expression on: ";
     124        os << std::string( indent, ' ' ) << "Sizeof Expression on: ";
    127125
    128126        if (isType)
     
    225223}
    226224
    227 OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) {
    228         add_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
    229 }
    230 
    231 OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {}
    232 
    233 OffsetPackExpr::~OffsetPackExpr() { delete type; }
    234 
    235 void OffsetPackExpr::print( std::ostream &os, int indent ) const {
    236         os << std::string( indent, ' ' ) << "Offset pack expression on ";
    237 
    238         if ( type ) {
    239                 type->print(os, indent + 2);
    240         } else {
    241                 os << "<NULL>";
    242         }
    243 
    244         os << std::endl;
    245         Expression::print( os, indent );
    246 }
    247 
    248225AttrExpr::AttrExpr( Expression *attr, Expression *expr_, Expression *_aname ) :
    249226                Expression( _aname ), attr( attr ), expr(expr_), type(0), isType(false) {
     
    297274
    298275void CastExpr::print( std::ostream &os, int indent ) const {
    299         os << "Cast of:" << std::endl << std::string( indent+2, ' ' );
     276        os << std::string( indent, ' ' ) << "Cast of:" << std::endl;
    300277        arg->print(os, indent+2);
    301278        os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl;
     
    320297
    321298void UntypedMemberExpr::print( std::ostream &os, int indent ) const {
    322         os << "Untyped Member Expression, with field: " << get_member();
     299        os << std::string( indent, ' ' ) << "Member Expression, with field: " << get_member();
    323300
    324301        Expression *agg = get_aggregate();
    325302        os << std::string( indent, ' ' ) << "from aggregate: ";
    326         if (agg != 0) {
    327                 os << std::string( indent+2, ' ' );
    328                 agg->print(os, indent + 2);
    329         }
    330         os << std::string( indent+2, ' ' );
     303        if (agg != 0) agg->print(os, indent + 2);
    331304        Expression::print( os, indent );
    332305}
     
    351324
    352325void MemberExpr::print( std::ostream &os, int indent ) const {
    353         os << "Member Expression, with field: " << std::endl;
     326        os << std::string( indent, ' ' ) << "Member Expression, with field: " << std::endl;
    354327
    355328        assert( member );
     
    360333        Expression *agg = get_aggregate();
    361334        os << std::string( indent, ' ' ) << "from aggregate: " << std::endl;
    362         if (agg != 0) {
    363                 os << std::string( indent+2, ' ' );
    364                 agg->print(os, indent + 2);
    365         }
    366         os << std::string( indent+2, ' ' );
     335        if (agg != 0) agg->print(os, indent + 2);
    367336        Expression::print( os, indent );
    368337}
     
    382351
    383352void UntypedExpr::print( std::ostream &os, int indent ) const {
    384         os << "Applying untyped: " << std::endl;
    385         os << std::string( indent, ' ' );
     353        os << std::string( indent, ' ' ) << "Applying untyped: " << std::endl;
    386354        function->print(os, indent + 4);
    387355        os << std::string( indent, ' ' ) << "...to: " << std::endl;
    388         os << std::string( indent, ' ' );
    389356        printArgs(os, indent + 4);
    390357        Expression::print( os, indent );
     
    405372
    406373void NameExpr::print( std::ostream &os, int indent ) const {
    407         os << "Name: " << get_name() << std::endl;
     374        os << std::string( indent, ' ' ) << "Name: " << get_name() << std::endl;
    408375        Expression::print( os, indent );
    409376}
     
    466433}
    467434
    468 
    469 ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) {
    470         assert( callExpr );
    471         cloneAll( callExpr->get_results(), results );
    472 }
    473 
    474 ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other ) : Expression( other ), callExpr( maybeClone( other.callExpr ) ) {
    475         cloneAll( other.tempDecls, tempDecls );
    476         cloneAll( other.returnDecls, returnDecls );
    477         cloneAll( other.dtors, dtors );
    478 }
    479 
    480 ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() {
    481         delete callExpr;
    482         deleteAll( tempDecls );
    483         deleteAll( returnDecls );
    484         deleteAll( dtors );
    485 }
    486 
    487 void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const {
    488         os << std::string( indent, ' ' ) <<  "Implicit Copy Constructor Expression: " << std::endl;
    489         assert( callExpr );
    490         callExpr->print( os, indent + 2 );
    491         os << std::endl << std::string( indent, ' ' ) << "with temporaries:" << std::endl;
    492         printAll(tempDecls, os, indent+2);
    493         os << std::endl << std::string( indent, ' ' ) << "with return temporaries:" << std::endl;
    494         printAll(returnDecls, os, indent+2);
    495         Expression::print( os, indent );
    496 }
    497 
    498435UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {}
    499436
Note: See TracChangeset for help on using the changeset viewer.