Changes in src/SynTree/Expression.cc [cdb990a:0f79853]
- File:
-
- 1 edited
-
src/SynTree/Expression.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
rcdb990a r0f79853 749 749 750 750 751 DefaultArgExpr::DefaultArgExpr( Expression * expr ) : expr( expr ) { 752 assert( expr->result ); 753 result = expr->result->clone(); 754 } 755 DefaultArgExpr::DefaultArgExpr( const DefaultArgExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ) {} 756 DefaultArgExpr::~DefaultArgExpr() { 757 delete expr; 758 } 759 760 void 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 765 GenericExpr::Association::Association( Type * type, Expression * expr ) : type( type ), expr( expr ), isDefault( false ) {} 766 GenericExpr::Association::Association( Expression * expr ) : type( nullptr ), expr( expr ), isDefault( true ) {} 767 GenericExpr::Association::Association( const Association & other ) : type( maybeClone( other.type ) ), expr( maybeClone( other.expr ) ), isDefault( other.isDefault ) {} 768 GenericExpr::Association::~Association() { 769 delete type; 770 delete expr; 771 } 772 773 GenericExpr::GenericExpr( Expression * control, const std::list<Association> & assoc ) : Expression(), control( control ), associations( assoc ) {} 774 GenericExpr::GenericExpr( const GenericExpr & other ) : Expression(other), control( maybeClone( other.control ) ), associations( other.associations ) { 775 } 776 GenericExpr::~GenericExpr() { 777 delete control; 778 } 779 780 void 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 751 800 // Local Variables: // 752 801 // tab-width: 4 //
Note:
See TracChangeset
for help on using the changeset viewer.