Changes in src/SynTree/Expression.cc [630a82a:e04ef3a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r630a82a re04ef3a 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) … … 212 217 213 218 os << " of "; 219 220 if ( type ) { 221 type->print(os, indent + 2); 222 } else { 223 os << "<NULL>"; 224 } 225 226 os << std::endl; 227 Expression::print( os, indent ); 228 } 229 230 OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) { 231 add_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) ); 232 } 233 234 OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {} 235 236 OffsetPackExpr::~OffsetPackExpr() { delete type; } 237 238 void OffsetPackExpr::print( std::ostream &os, int indent ) const { 239 os << std::string( indent, ' ' ) << "Offset pack expression on "; 214 240 215 241 if ( type ) { … … 274 300 275 301 void CastExpr::print( std::ostream &os, int indent ) const { 276 os << std::string( indent, ' ' ) << "Cast of:" << std::endl;302 os << "Cast of:" << std::endl << std::string( indent+2, ' ' ); 277 303 arg->print(os, indent+2); 278 304 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; … … 297 323 298 324 void UntypedMemberExpr::print( std::ostream &os, int indent ) const { 299 os << std::string( indent, ' ' ) << "Member Expression, with field: " << get_member();325 os << "Untyped Member Expression, with field: " << get_member(); 300 326 301 327 Expression *agg = get_aggregate(); 302 os << std::string( indent, ' ' ) << "from aggregate: "; 303 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, ' ' ); 304 334 Expression::print( os, indent ); 305 335 } … … 324 354 325 355 void MemberExpr::print( std::ostream &os, int indent ) const { 326 os << std::string( indent, ' ' ) <<"Member Expression, with field: " << std::endl;356 os << "Member Expression, with field: " << std::endl; 327 357 328 358 assert( member ); … … 333 363 Expression *agg = get_aggregate(); 334 364 os << std::string( indent, ' ' ) << "from aggregate: " << std::endl; 335 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, ' ' ); 336 370 Expression::print( os, indent ); 337 371 } … … 351 385 352 386 void UntypedExpr::print( std::ostream &os, int indent ) const { 353 os << std::string( indent, ' ' ) << "Applying untyped: " << std::endl; 354 function->print(os, indent + 4); 387 os << "Applying untyped: " << std::endl; 388 os << std::string( indent+2, ' ' ); 389 function->print(os, indent + 2); 355 390 os << std::string( indent, ' ' ) << "...to: " << std::endl; 356 printA rgs(os, indent + 4);391 printAll(args, os, indent + 2); 357 392 Expression::print( os, indent ); 358 393 } … … 360 395 void UntypedExpr::printArgs( std::ostream &os, int indent ) const { 361 396 std::list<Expression *>::const_iterator i; 362 for (i = args.begin(); i != args.end(); i++) 397 for (i = args.begin(); i != args.end(); i++) { 398 os << std::string(indent, ' ' ); 363 399 (*i)->print(os, indent); 400 } 364 401 } 365 402 … … 372 409 373 410 void NameExpr::print( std::ostream &os, int indent ) const { 374 os << std::string( indent, ' ' ) <<"Name: " << get_name() << std::endl;411 os << "Name: " << get_name() << std::endl; 375 412 Expression::print( os, indent ); 376 413 } … … 433 470 } 434 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 435 502 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {} 436 503
Note:
See TracChangeset
for help on using the changeset viewer.