Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    r630a82a rdc2e7e0  
    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 : Mon Apr 18 17:25:06 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.results, results );
     466        cloneAll( other.copyCtors, copyCtors );
     467        cloneAll( other.tempDecls, tempDecls );
     468        cloneAll( other.returnDecls, returnDecls );
     469        cloneAll( other.dtors, dtors );
     470}
     471
     472ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() {
     473        delete callExpr;
     474        deleteAll( copyCtors );
     475        deleteAll( tempDecls );
     476        deleteAll( returnDecls );
     477        deleteAll( dtors );
     478}
     479
     480void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const {
     481        os << std::string( indent, ' ' ) <<  "Implicit Copy Constructor Expression: " << std::endl;
     482        assert( callExpr );
     483        callExpr->print( os, indent + 2 );
     484        os << std::endl << std::string( indent, ' ' ) << "with temporaries:" << std::endl;
     485        printAll(tempDecls, os, indent+2);
     486        os << std::endl << std::string( indent, ' ' ) << "with copyCtors:" << std::endl;
     487        printAll(copyCtors, os, indent+2);
     488        os << std::endl << std::string( indent, ' ' ) << "with return temporaries:" << std::endl;
     489        printAll(returnDecls, os, indent+2);
     490        Expression::print( os, indent );
     491}
     492
    435493UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {}
    436494
Note: See TracChangeset for help on using the changeset viewer.