Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    r630a82a r845cedc  
    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 : Fri Apr 22 16:20:43 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() );
    8183        add_result( var->get_type()->clone() );
    8284        for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) {
     
    212214
    213215        os << " of ";
     216
     217        if ( type ) {
     218                type->print(os, indent + 2);
     219        } else {
     220                os << "<NULL>";
     221        }
     222
     223        os << std::endl;
     224        Expression::print( os, indent );
     225}
     226
     227OffsetPackExpr::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
     231OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {}
     232
     233OffsetPackExpr::~OffsetPackExpr() { delete type; }
     234
     235void OffsetPackExpr::print( std::ostream &os, int indent ) const {
     236        os << std::string( indent, ' ' ) << "Offset pack expression on ";
    214237
    215238        if ( type ) {
     
    433456}
    434457
     458
     459ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) {
     460        assert( callExpr );
     461        cloneAll( callExpr->get_results(), results );
     462}
     463
     464ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other ) : Expression( other ), callExpr( maybeClone( other.callExpr ) ) {
     465        cloneAll( other.copyCtors, copyCtors );
     466        cloneAll( other.tempDecls, tempDecls );
     467        cloneAll( other.returnDecls, returnDecls );
     468        cloneAll( other.dtors, dtors );
     469}
     470
     471ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() {
     472        delete callExpr;
     473        deleteAll( copyCtors );
     474        deleteAll( tempDecls );
     475        deleteAll( returnDecls );
     476        deleteAll( dtors );
     477}
     478
     479void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const {
     480        os << std::string( indent, ' ' ) <<  "Implicit Copy Constructor Expression: " << std::endl;
     481        assert( callExpr );
     482        callExpr->print( os, indent + 2 );
     483        os << std::endl << std::string( indent, ' ' ) << "with temporaries:" << std::endl;
     484        printAll(tempDecls, os, indent+2);
     485        os << std::endl << std::string( indent, ' ' ) << "with copyCtors:" << std::endl;
     486        printAll(copyCtors, os, indent+2);
     487        os << std::endl << std::string( indent, ' ' ) << "with return temporaries:" << std::endl;
     488        printAll(returnDecls, os, indent+2);
     489        Expression::print( os, indent );
     490}
     491
    435492UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {}
    436493
Note: See TracChangeset for help on using the changeset viewer.