Changes in src/SynTree/Expression.cc [b6fe7e6:3b58d91]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
rb6fe7e6 r3b58d91 28 28 #include "TypeSubstitution.h" 29 29 #include "Common/utility.h" 30 #include "InitTweak/InitTweak.h"31 30 32 31 … … 311 310 } 312 311 313 UntypedMemberExpr::UntypedMemberExpr( std::string_member, Expression *_aggregate, Expression *_aname ) :312 UntypedMemberExpr::UntypedMemberExpr( Expression * _member, Expression *_aggregate, Expression *_aname ) : 314 313 Expression( _aname ), member(_member), aggregate(_aggregate) {} 315 314 316 315 UntypedMemberExpr::UntypedMemberExpr( const UntypedMemberExpr &other ) : 317 Expression( other ), member( other.member), aggregate( maybeClone( other.aggregate ) ) {316 Expression( other ), member( maybeClone( other.member ) ), aggregate( maybeClone( other.aggregate ) ) { 318 317 } 319 318 320 319 UntypedMemberExpr::~UntypedMemberExpr() { 321 320 delete aggregate; 321 delete member; 322 322 } 323 323 324 324 void UntypedMemberExpr::print( std::ostream &os, int indent ) const { 325 os << "Untyped Member Expression, with field: " << get_member(); 325 os << "Untyped Member Expression, with field: " << std::endl; 326 get_member()->print(os, indent+4); 327 os << std::string( indent+2, ' ' ); 326 328 327 329 Expression *agg = get_aggregate(); 328 os << " , from aggregate: ";330 os << "from aggregate: " << std::endl; 329 331 if (agg != 0) { 330 os << std::string( indent + 2, ' ' );331 agg->print(os, indent + 2);332 os << std::string( indent + 4, ' ' ); 333 agg->print(os, indent + 4); 332 334 } 333 335 os << std::string( indent+2, ' ' ); … … 494 496 495 497 void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const { 496 os << "Implicit Copy Constructor Expression: " << std::endl;498 os << std::string( indent, ' ' ) << "Implicit Copy Constructor Expression: " << std::endl; 497 499 assert( callExpr ); 498 500 callExpr->print( os, indent + 2 ); … … 504 506 } 505 507 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 ); 508 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {} 509 510 UntypedValofExpr::~UntypedValofExpr() { delete body; } 511 512 void UntypedValofExpr::print( std::ostream &os, int indent ) const { 513 os << std::string( indent, ' ' ) << "Valof Expression: " << std::endl; 514 if ( get_body() != 0 ) 515 get_body()->print( os, indent + 2 ); 528 516 } 529 517 … … 544 532 if ( type ) type->print( os, indent + 2 ); 545 533 if ( initializer ) initializer->print( os, indent + 2 ); 546 }547 548 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {}549 550 UntypedValofExpr::~UntypedValofExpr() { delete body; }551 552 void UntypedValofExpr::print( std::ostream &os, int indent ) const {553 os << std::string( indent, ' ' ) << "Valof Expression: " << std::endl;554 if ( get_body() != 0 )555 get_body()->print( os, indent + 2 );556 534 } 557 535
Note:
See TracChangeset
for help on using the changeset viewer.