Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    rcdb990a r0f79853  
    749749
    750750
     751DefaultArgExpr::DefaultArgExpr( Expression * expr ) : expr( expr ) {
     752        assert( expr->result );
     753        result = expr->result->clone();
     754}
     755DefaultArgExpr::DefaultArgExpr( const DefaultArgExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ) {}
     756DefaultArgExpr::~DefaultArgExpr() {
     757        delete expr;
     758}
     759
     760void DefaultArgExpr::print( std::ostream & os, Indenter indent ) const {
     761        os << "Default Argument Expression" << std::endl << indent+1;
     762        expr->print( os, indent+1 );
     763}
     764
     765GenericExpr::Association::Association( Type * type, Expression * expr ) : type( type ), expr( expr ), isDefault( false ) {}
     766GenericExpr::Association::Association( Expression * expr ) : type( nullptr ), expr( expr ), isDefault( true ) {}
     767GenericExpr::Association::Association( const Association & other ) : type( maybeClone( other.type ) ), expr( maybeClone( other.expr ) ), isDefault( other.isDefault ) {}
     768GenericExpr::Association::~Association() {
     769        delete type;
     770        delete expr;
     771}
     772
     773GenericExpr::GenericExpr( Expression * control, const std::list<Association> & assoc ) : Expression(), control( control ), associations( assoc ) {}
     774GenericExpr::GenericExpr( const GenericExpr & other ) : Expression(other), control( maybeClone( other.control ) ), associations( other.associations ) {
     775}
     776GenericExpr::~GenericExpr() {
     777        delete control;
     778}
     779
     780void GenericExpr::print( std::ostream & os, Indenter indent ) const {
     781        os << "C11 _Generic Expression" << std::endl << indent+1;
     782        control->print( os, indent+1 );
     783        os << std::endl << indent+1 << "... with associations: " << std::endl;
     784        for ( const Association & assoc : associations ) {
     785                os << indent+1;
     786                if (assoc.isDefault) {
     787                        os << "... default: ";
     788                        assoc.expr->print( os, indent+1 );
     789                } else {
     790                        os << "... type: ";
     791                        assoc.type->print( os, indent+1 );
     792                        os << std::endl << indent+1 << "... expression: ";
     793                        assoc.expr->print( os, indent+1 );
     794                        os << std::endl;
     795                }
     796                os << std::endl;
     797        }
     798}
     799
    751800// Local Variables: //
    752801// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.