Changeset add7117 for src/SynTree/Expression.cc
- Timestamp:
- Sep 10, 2016, 11:08:47 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 5af62f1
- Parents:
- f5e81d1 (diff), 03e3117 (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
rf5e81d1 radd7117 28 28 #include "TypeSubstitution.h" 29 29 #include "Common/utility.h" 30 #include "InitTweak/InitTweak.h" 30 31 31 32 … … 496 497 497 498 void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const { 498 os << std::string( indent, ' ' ) <<"Implicit Copy Constructor Expression: " << std::endl;499 os << "Implicit Copy Constructor Expression: " << std::endl; 499 500 assert( callExpr ); 500 501 callExpr->print( os, indent + 2 ); … … 506 507 } 507 508 509 510 ConstructorExpr::ConstructorExpr( Expression * callExpr ) : callExpr( callExpr ) { 511 // allow resolver to type a constructor used as an expression as if it has the same type as its first argument 512 assert( callExpr ); 513 Expression * arg = InitTweak::getCallArg( callExpr, 0 ); 514 assert( arg ); 515 cloneAll( arg->get_results(), results ); 516 } 517 518 ConstructorExpr::ConstructorExpr( const ConstructorExpr & other ) : Expression( other ), callExpr( maybeClone( other.callExpr ) ) { 519 } 520 521 ConstructorExpr::~ConstructorExpr() { 522 delete callExpr; 523 } 524 525 void ConstructorExpr::print( std::ostream &os, int indent ) const { 526 os << "Constructor Expression: " << std::endl; 527 assert( callExpr ); 528 os << std::string( indent+2, ' ' ); 529 callExpr->print( os, indent + 2 ); 530 Expression::print( os, indent ); 531 } 532 533 534 CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : type( type ), initializer( initializer ) { 535 add_result( type->clone() ); 536 } 537 538 CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), type( maybeClone( other.type ) ), initializer( maybeClone( other.initializer ) ) {} 539 540 CompoundLiteralExpr::~CompoundLiteralExpr() { 541 delete initializer; 542 delete type; 543 } 544 545 void CompoundLiteralExpr::print( std::ostream &os, int indent ) const { 546 os << "Compound Literal Expression: " << std::endl; 547 if ( type ) type->print( os, indent + 2 ); 548 if ( initializer ) initializer->print( os, indent + 2 ); 549 } 550 508 551 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {} 509 552 … … 514 557 if ( get_body() != 0 ) 515 558 get_body()->print( os, indent + 2 ); 516 }517 518 519 CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : type( type ), initializer( initializer ) {520 add_result( type->clone() );521 }522 523 CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), type( maybeClone( other.type ) ), initializer( maybeClone( other.initializer ) ) {}524 525 CompoundLiteralExpr::~CompoundLiteralExpr() {526 delete initializer;527 delete type;528 }529 530 void CompoundLiteralExpr::print( std::ostream &os, int indent ) const {531 os << "Compound Literal Expression: " << std::endl;532 if ( type ) type->print( os, indent + 2 );533 if ( initializer ) initializer->print( os, indent + 2 );534 559 } 535 560
Note: See TracChangeset
for help on using the changeset viewer.