Changeset 9c23f31 for src/SynTree/Expression.cc
- Timestamp:
- Sep 24, 2016, 12:19:33 PM (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:
- 3b5e3aa
- Parents:
- 2298f728 (diff), 7ae930a (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
r2298f728 r9c23f31 28 28 #include "TypeSubstitution.h" 29 29 #include "Common/utility.h" 30 #include "InitTweak/InitTweak.h" 30 31 31 32 … … 493 494 494 495 void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const { 495 os << std::string( indent, ' ' ) <<"Implicit Copy Constructor Expression: " << std::endl;496 os << "Implicit Copy Constructor Expression: " << std::endl; 496 497 assert( callExpr ); 497 498 callExpr->print( os, indent + 2 ); … … 503 504 } 504 505 506 507 ConstructorExpr::ConstructorExpr( Expression * callExpr ) : callExpr( callExpr ) { 508 // allow resolver to type a constructor used as an expression as if it has the same type as its first argument 509 assert( callExpr ); 510 Expression * arg = InitTweak::getCallArg( callExpr, 0 ); 511 assert( arg ); 512 cloneAll( arg->get_results(), results ); 513 } 514 515 ConstructorExpr::ConstructorExpr( const ConstructorExpr & other ) : Expression( other ), callExpr( maybeClone( other.callExpr ) ) { 516 } 517 518 ConstructorExpr::~ConstructorExpr() { 519 delete callExpr; 520 } 521 522 void ConstructorExpr::print( std::ostream &os, int indent ) const { 523 os << "Constructor Expression: " << std::endl; 524 assert( callExpr ); 525 os << std::string( indent+2, ' ' ); 526 callExpr->print( os, indent + 2 ); 527 Expression::print( os, indent ); 528 } 529 530 531 CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : type( type ), initializer( initializer ) { 532 add_result( type->clone() ); 533 } 534 535 CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), type( maybeClone( other.type ) ), initializer( maybeClone( other.initializer ) ) {} 536 537 CompoundLiteralExpr::~CompoundLiteralExpr() { 538 delete initializer; 539 delete type; 540 } 541 542 void CompoundLiteralExpr::print( std::ostream &os, int indent ) const { 543 os << "Compound Literal Expression: " << std::endl; 544 if ( type ) type->print( os, indent + 2 ); 545 if ( initializer ) initializer->print( os, indent + 2 ); 546 } 547 505 548 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {} 506 549 … … 511 554 if ( get_body() != 0 ) 512 555 get_body()->print( os, indent + 2 ); 513 }514 515 516 CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : type( type ), initializer( initializer ) {517 add_result( type->clone() );518 }519 520 CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), type( maybeClone( other.type ) ), initializer( maybeClone( other.initializer ) ) {}521 522 CompoundLiteralExpr::~CompoundLiteralExpr() {523 delete initializer;524 delete type;525 }526 527 void CompoundLiteralExpr::print( std::ostream &os, int indent ) const {528 os << "Compound Literal Expression: " << std::endl;529 if ( type ) type->print( os, indent + 2 );530 if ( initializer ) initializer->print( os, indent + 2 );531 556 } 532 557
Note: See TracChangeset
for help on using the changeset viewer.