Changeset 28f3a19 for src/SynTree/Expression.cc
- Timestamp:
- Jun 27, 2018, 3:28:41 PM (6 years ago)
- Branches:
- new-env, with_gc
- Children:
- b21c77a
- Parents:
- 0182bfa (diff), 63238a4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r0182bfa r28f3a19 640 640 641 641 642 DefaultArgExpr::DefaultArgExpr( Expression * expr ) : expr( expr ) { 643 assert( expr->result ); 644 result = expr->result->clone(); 645 } 646 DefaultArgExpr::DefaultArgExpr( const DefaultArgExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ) {} 647 648 void DefaultArgExpr::print( std::ostream & os, Indenter indent ) const { 649 os << "Default Argument Expression" << std::endl << indent+1; 650 expr->print( os, indent+1 ); 651 } 652 653 GenericExpr::Association::Association( Type * type, Expression * expr ) : type( type ), expr( expr ), isDefault( false ) {} 654 GenericExpr::Association::Association( Expression * expr ) : type( nullptr ), expr( expr ), isDefault( true ) {} 655 GenericExpr::Association::Association( const Association & other ) : type( maybeClone( other.type ) ), expr( maybeClone( other.expr ) ), isDefault( other.isDefault ) {} 656 657 GenericExpr::GenericExpr( Expression * control, const std::list<Association> & assoc ) : Expression(), control( control ), associations( assoc ) {} 658 GenericExpr::GenericExpr( const GenericExpr & other ) : Expression(other), control( maybeClone( other.control ) ), associations( other.associations ) {} 659 GenericExpr::~GenericExpr() {} 660 661 void GenericExpr::print( std::ostream & os, Indenter indent ) const { 662 os << "C11 _Generic Expression" << std::endl << indent+1; 663 control->print( os, indent+1 ); 664 os << std::endl << indent+1 << "... with associations: " << std::endl; 665 for ( const Association & assoc : associations ) { 666 os << indent+1; 667 if (assoc.isDefault) { 668 os << "... default: "; 669 assoc.expr->print( os, indent+1 ); 670 } else { 671 os << "... type: "; 672 assoc.type->print( os, indent+1 ); 673 os << std::endl << indent+1 << "... expression: "; 674 assoc.expr->print( os, indent+1 ); 675 os << std::endl; 676 } 677 os << std::endl; 678 } 679 } 680 642 681 // Local Variables: // 643 682 // tab-width: 4 //
Note: See TracChangeset
for help on using the changeset viewer.