Changes in src/SynTree/Expression.cc [cdb990a:d807ca28]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
rcdb990a rd807ca28 748 748 } 749 749 750 GenericExpr::Association::Association( Type * type, Expression * expr ) : type( type ), expr( expr ), isDefault( false ) {} 751 GenericExpr::Association::Association( Expression * expr ) : type( nullptr ), expr( expr ), isDefault( true ) {} 752 GenericExpr::Association::Association( const Association & other ) : type( maybeClone( other.type ) ), expr( maybeClone( other.expr ) ), isDefault( other.isDefault ) {} 753 GenericExpr::Association::~Association() { 754 delete type; 755 delete expr; 756 } 757 758 GenericExpr::GenericExpr( Expression * control, const std::list<Association> & assoc ) : Expression(), control( control ), associations( assoc ) {} 759 GenericExpr::GenericExpr( const GenericExpr & other ) : Expression(other), control( maybeClone( other.control ) ), associations( other.associations ) { 760 } 761 GenericExpr::~GenericExpr() { 762 delete control; 763 } 764 765 void GenericExpr::print( std::ostream & os, Indenter indent ) const { 766 os << "C11 _Generic Expression" << std::endl << indent+1; 767 control->print( os, indent+1 ); 768 os << std::endl << indent+1 << "... with associations: " << std::endl; 769 for ( const Association & assoc : associations ) { 770 os << indent+1; 771 if (assoc.isDefault) { 772 os << "... default: "; 773 assoc.expr->print( os, indent+1 ); 774 } else { 775 os << "... type: "; 776 assoc.type->print( os, indent+1 ); 777 os << std::endl << indent+1 << "... expression: "; 778 assoc.expr->print( os, indent+1 ); 779 os << std::endl; 780 } 781 os << std::endl; 782 } 783 } 750 784 751 785 // Local Variables: //
Note: See TracChangeset
for help on using the changeset viewer.