Changeset f80e0218 for src/SynTree/Expression.cc
- Timestamp:
- Jun 30, 2016, 4:32:56 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- ea29e73
- Parents:
- 1b5c81ed (diff), 84d4d6f (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
r1b5c81ed rf80e0218 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Apr 8 17:16:23201613 // Update Count : 4 012 // Last Modified On : Mon Jun 13 16:03:39 2016 13 // Update Count : 42 14 14 // 15 15 … … 32 32 Expression::Expression( Expression *_aname ) : env( 0 ), argName( _aname ) {} 33 33 34 Expression::Expression( const Expression &other ) : env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ) {34 Expression::Expression( const Expression &other ) : env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ), extension( other.extension ) { 35 35 cloneAll( other.results, results ); 36 36 } … … 60 60 argName->print( os, indent+2 ); 61 61 } // if 62 63 if ( extension ) { 64 os << std::string( indent, ' ' ) << "with extension:"; 65 } // if 62 66 } 63 67 … … 72 76 73 77 void ConstantExpr::print( std::ostream &os, int indent ) const { 74 os << std::string( indent, ' ' ) <<"constant expression " ;78 os << "constant expression " ; 75 79 constant.print( os ); 76 80 Expression::print( os, indent ); 77 os << std::endl;78 81 } 79 82 80 83 VariableExpr::VariableExpr( DeclarationWithType *_var, Expression *_aname ) : Expression( _aname ), var( _var ) { 84 assert( var ); 85 assert( var->get_type() ); 81 86 add_result( var->get_type()->clone() ); 82 87 for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) { … … 93 98 94 99 void VariableExpr::print( std::ostream &os, int indent ) const { 95 os << std::string( indent, ' ' ) <<"Variable Expression: ";100 os << "Variable Expression: "; 96 101 97 102 Declaration *decl = get_var(); … … 122 127 123 128 void SizeofExpr::print( std::ostream &os, int indent) const { 124 os << std::string( indent, ' ' ) <<"Sizeof Expression on: ";129 os << "Sizeof Expression on: "; 125 130 126 131 if (isType) … … 295 300 296 301 void CastExpr::print( std::ostream &os, int indent ) const { 297 os << std::string( indent, ' ' ) << "Cast of:" << std::endl;302 os << "Cast of:" << std::endl << std::string( indent+2, ' ' ); 298 303 arg->print(os, indent+2); 299 304 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; … … 318 323 319 324 void UntypedMemberExpr::print( std::ostream &os, int indent ) const { 320 os << std::string( indent, ' ' ) << "Member Expression, with field: " << get_member();325 os << "Untyped Member Expression, with field: " << get_member(); 321 326 322 327 Expression *agg = get_aggregate(); 323 os << std::string( indent, ' ' ) << "from aggregate: "; 324 if (agg != 0) agg->print(os, indent + 2); 328 os << ", from aggregate: "; 329 if (agg != 0) { 330 os << std::string( indent + 2, ' ' ); 331 agg->print(os, indent + 2); 332 } 333 os << std::string( indent+2, ' ' ); 325 334 Expression::print( os, indent ); 326 335 } … … 345 354 346 355 void MemberExpr::print( std::ostream &os, int indent ) const { 347 os << std::string( indent, ' ' ) <<"Member Expression, with field: " << std::endl;356 os << "Member Expression, with field: " << std::endl; 348 357 349 358 assert( member ); … … 354 363 Expression *agg = get_aggregate(); 355 364 os << std::string( indent, ' ' ) << "from aggregate: " << std::endl; 356 if (agg != 0) agg->print(os, indent + 2); 365 if (agg != 0) { 366 os << std::string( indent + 2, ' ' ); 367 agg->print(os, indent + 2); 368 } 369 os << std::string( indent+2, ' ' ); 357 370 Expression::print( os, indent ); 358 371 } … … 372 385 373 386 void UntypedExpr::print( std::ostream &os, int indent ) const { 374 os << std::string( indent, ' ' ) << "Applying untyped: " << std::endl; 375 function->print(os, indent + 4); 387 os << "Applying untyped: " << std::endl; 388 os << std::string( indent+2, ' ' ); 389 function->print(os, indent + 2); 376 390 os << std::string( indent, ' ' ) << "...to: " << std::endl; 377 printA rgs(os, indent + 4);391 printAll(args, os, indent + 2); 378 392 Expression::print( os, indent ); 379 393 } … … 381 395 void UntypedExpr::printArgs( std::ostream &os, int indent ) const { 382 396 std::list<Expression *>::const_iterator i; 383 for (i = args.begin(); i != args.end(); i++) 397 for (i = args.begin(); i != args.end(); i++) { 398 os << std::string(indent, ' ' ); 384 399 (*i)->print(os, indent); 400 } 385 401 } 386 402 … … 393 409 394 410 void NameExpr::print( std::ostream &os, int indent ) const { 395 os << std::string( indent, ' ' ) <<"Name: " << get_name() << std::endl;411 os << "Name: " << get_name() << std::endl; 396 412 Expression::print( os, indent ); 397 413 } … … 454 470 } 455 471 472 473 ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) { 474 assert( callExpr ); 475 cloneAll( callExpr->get_results(), results ); 476 } 477 478 ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other ) : Expression( other ), callExpr( maybeClone( other.callExpr ) ) { 479 cloneAll( other.tempDecls, tempDecls ); 480 cloneAll( other.returnDecls, returnDecls ); 481 cloneAll( other.dtors, dtors ); 482 } 483 484 ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() { 485 delete callExpr; 486 deleteAll( tempDecls ); 487 deleteAll( returnDecls ); 488 deleteAll( dtors ); 489 } 490 491 void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const { 492 os << std::string( indent, ' ' ) << "Implicit Copy Constructor Expression: " << std::endl; 493 assert( callExpr ); 494 callExpr->print( os, indent + 2 ); 495 os << std::endl << std::string( indent, ' ' ) << "with temporaries:" << std::endl; 496 printAll(tempDecls, os, indent+2); 497 os << std::endl << std::string( indent, ' ' ) << "with return temporaries:" << std::endl; 498 printAll(returnDecls, os, indent+2); 499 Expression::print( os, indent ); 500 } 501 456 502 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {} 457 503
Note:
See TracChangeset
for help on using the changeset viewer.