Changes in src/SynTree/Expression.cc [af5c204a:e4d829b]
- File:
-
- 1 edited
-
src/SynTree/Expression.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
raf5c204a re4d829b 92 92 93 93 Declaration *decl = get_var(); 94 // if ( decl != 0) decl->print(os, indent + 2);95 94 if ( decl != 0) decl->printShort(os, indent + 2); 96 95 os << std::endl; … … 287 286 delete arg; 288 287 } 288 289 // CastExpr *CastExpr::clone() const { return 0; } 289 290 290 291 void CastExpr::print( std::ostream &os, int indent ) const { … … 353 354 } 354 355 356 //// is this right? It's cloning the member, but the member is a declaration so probably shouldn't be cloned... 355 357 MemberExpr::MemberExpr( const MemberExpr &other ) : 356 358 Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) { … … 358 360 359 361 MemberExpr::~MemberExpr() { 360 // d on't delete the member declaration, since it points somewhere else in the tree362 // delete member; 361 363 delete aggregate; 362 364 } … … 588 590 } 589 591 592 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {} 593 594 UntypedValofExpr::~UntypedValofExpr() { delete body; } 595 596 void UntypedValofExpr::print( std::ostream &os, int indent ) const { 597 os << std::string( indent, ' ' ) << "Valof Expression: " << std::endl; 598 if ( get_body() != 0 ) 599 get_body()->print( os, indent + 2 ); 600 } 601 590 602 RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {} 591 603 RangeExpr::RangeExpr( const RangeExpr &other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {} … … 657 669 } 658 670 671 InitAlternative::InitAlternative( Type * type, Designation * designation ) : type( type ), designation( designation ) {} 672 InitAlternative::InitAlternative( const InitAlternative & other ) : type( maybeClone( other.type ) ), designation( maybeClone( other.designation ) ) {} 673 InitAlternative::~InitAlternative() { 674 delete type; 675 delete designation; 676 } 677 678 UntypedInitExpr::UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts ) : expr( expr ), initAlts( initAlts ) {} 679 UntypedInitExpr::UntypedInitExpr( const UntypedInitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), initAlts( other.initAlts ) {} 680 UntypedInitExpr::~UntypedInitExpr() { 681 delete expr; 682 } 683 684 void UntypedInitExpr::print( std::ostream & os, int indent ) const { 685 os << "Untyped Init Expression" << std::endl << std::string( indent+2, ' ' ); 686 expr->print( os, indent+2 ); 687 if ( ! initAlts.empty() ) { 688 for ( const InitAlternative & alt : initAlts ) { 689 os << std::string( indent+2, ' ' ) << "InitAlternative: "; 690 alt.type->print( os, indent+2 ); 691 alt.designation->print( os, indent+2 ); 692 } 693 } 694 } 695 696 InitExpr::InitExpr( Expression * expr, Type * type, Designation * designation ) : expr( expr ), designation( designation ) { 697 set_result( type ); 698 } 699 InitExpr::InitExpr( const InitExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), designation( maybeClone( other.designation) ) {} 700 InitExpr::~InitExpr() { 701 delete expr; 702 delete designation; 703 } 704 705 void InitExpr::print( std::ostream & os, int indent ) const { 706 os << "Init Expression" << std::endl << std::string( indent+2, ' ' ); 707 expr->print( os, indent+2 ); 708 os << std::string( indent+2, ' ' ) << "with designation: "; 709 designation->print( os, indent+2 ); 710 } 711 712 659 713 std::ostream & operator<<( std::ostream & out, const Expression * expr ) { 660 714 if ( expr ) {
Note:
See TracChangeset
for help on using the changeset viewer.