Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    r60089f4 r4ffdd63  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Apr 26 12:52:40 2016
     12// Last Modified On : Wed Apr 27 17:07:19 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 );
     
    7979
    8080VariableExpr::VariableExpr( DeclarationWithType *_var, Expression *_aname ) : Expression( _aname ), var( _var ) {
     81        assert( var );
     82        assert( var->get_type() );
    8183        add_result( var->get_type()->clone() );
    8284        for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) {
     
    381383void UntypedExpr::print( std::ostream &os, int indent ) const {
    382384        os << "Applying untyped: " << std::endl;
    383         os << std::string( indent+4, ' ' );
     385        os << std::string( indent, ' ' );
    384386        function->print(os, indent + 4);
    385387        os << std::string( indent, ' ' ) << "...to: " << std::endl;
    386         printAll(args, os, indent + 4);
     388        os << std::string( indent, ' ' );
     389        printArgs(os, indent + 4);
    387390        Expression::print( os, indent );
    388391}
     
    390393void UntypedExpr::printArgs( std::ostream &os, int indent ) const {
    391394        std::list<Expression *>::const_iterator i;
    392         for (i = args.begin(); i != args.end(); i++) {
    393                 os << std::string(indent, ' ' );
     395        for (i = args.begin(); i != args.end(); i++)
    394396                (*i)->print(os, indent);
    395         }
    396397}
    397398
     
    465466}
    466467
     468
     469ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) {
     470        assert( callExpr );
     471        cloneAll( callExpr->get_results(), results );
     472}
     473
     474ImplicitCopyCtorExpr::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
     480ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() {
     481        delete callExpr;
     482        deleteAll( tempDecls );
     483        deleteAll( returnDecls );
     484        deleteAll( dtors );
     485}
     486
     487void 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
    467498UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {}
    468499
Note: See TracChangeset for help on using the changeset viewer.