Changes in src/SynTree/Expression.cc [630a82a:4ffdd63]
- File:
-
- 1 edited
-
src/SynTree/Expression.cc (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r630a82a r4ffdd63 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Apr 8 17:16:23201611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Apr 27 17:07:19 2016 13 13 // Update Count : 40 14 14 // … … 79 79 80 80 VariableExpr::VariableExpr( DeclarationWithType *_var, Expression *_aname ) : Expression( _aname ), var( _var ) { 81 assert( var ); 82 assert( var->get_type() ); 81 83 add_result( var->get_type()->clone() ); 82 84 for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) { … … 93 95 94 96 void VariableExpr::print( std::ostream &os, int indent ) const { 95 os << std::string( indent, ' ' ) <<"Variable Expression: ";97 os << "Variable Expression: "; 96 98 97 99 Declaration *decl = get_var(); … … 122 124 123 125 void SizeofExpr::print( std::ostream &os, int indent) const { 124 os << std::string( indent, ' ' ) <<"Sizeof Expression on: ";126 os << "Sizeof Expression on: "; 125 127 126 128 if (isType) … … 223 225 } 224 226 227 OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) { 228 add_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) ); 229 } 230 231 OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {} 232 233 OffsetPackExpr::~OffsetPackExpr() { delete type; } 234 235 void OffsetPackExpr::print( std::ostream &os, int indent ) const { 236 os << std::string( indent, ' ' ) << "Offset pack expression on "; 237 238 if ( type ) { 239 type->print(os, indent + 2); 240 } else { 241 os << "<NULL>"; 242 } 243 244 os << std::endl; 245 Expression::print( os, indent ); 246 } 247 225 248 AttrExpr::AttrExpr( Expression *attr, Expression *expr_, Expression *_aname ) : 226 249 Expression( _aname ), attr( attr ), expr(expr_), type(0), isType(false) { … … 274 297 275 298 void CastExpr::print( std::ostream &os, int indent ) const { 276 os << std::string( indent, ' ' ) << "Cast of:" << std::endl;299 os << "Cast of:" << std::endl << std::string( indent+2, ' ' ); 277 300 arg->print(os, indent+2); 278 301 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; … … 297 320 298 321 void UntypedMemberExpr::print( std::ostream &os, int indent ) const { 299 os << std::string( indent, ' ' ) << "Member Expression, with field: " << get_member();322 os << "Untyped Member Expression, with field: " << get_member(); 300 323 301 324 Expression *agg = get_aggregate(); 302 325 os << std::string( indent, ' ' ) << "from aggregate: "; 303 if (agg != 0) agg->print(os, indent + 2); 326 if (agg != 0) { 327 os << std::string( indent+2, ' ' ); 328 agg->print(os, indent + 2); 329 } 330 os << std::string( indent+2, ' ' ); 304 331 Expression::print( os, indent ); 305 332 } … … 324 351 325 352 void MemberExpr::print( std::ostream &os, int indent ) const { 326 os << std::string( indent, ' ' ) <<"Member Expression, with field: " << std::endl;353 os << "Member Expression, with field: " << std::endl; 327 354 328 355 assert( member ); … … 333 360 Expression *agg = get_aggregate(); 334 361 os << std::string( indent, ' ' ) << "from aggregate: " << std::endl; 335 if (agg != 0) agg->print(os, indent + 2); 362 if (agg != 0) { 363 os << std::string( indent+2, ' ' ); 364 agg->print(os, indent + 2); 365 } 366 os << std::string( indent+2, ' ' ); 336 367 Expression::print( os, indent ); 337 368 } … … 351 382 352 383 void UntypedExpr::print( std::ostream &os, int indent ) const { 353 os << std::string( indent, ' ' ) << "Applying untyped: " << std::endl; 384 os << "Applying untyped: " << std::endl; 385 os << std::string( indent, ' ' ); 354 386 function->print(os, indent + 4); 355 387 os << std::string( indent, ' ' ) << "...to: " << std::endl; 388 os << std::string( indent, ' ' ); 356 389 printArgs(os, indent + 4); 357 390 Expression::print( os, indent ); … … 372 405 373 406 void NameExpr::print( std::ostream &os, int indent ) const { 374 os << std::string( indent, ' ' ) <<"Name: " << get_name() << std::endl;407 os << "Name: " << get_name() << std::endl; 375 408 Expression::print( os, indent ); 376 409 } … … 433 466 } 434 467 468 469 ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) { 470 assert( callExpr ); 471 cloneAll( callExpr->get_results(), results ); 472 } 473 474 ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other ) : Expression( other ), callExpr( maybeClone( other.callExpr ) ) { 475 cloneAll( other.tempDecls, tempDecls ); 476 cloneAll( other.returnDecls, returnDecls ); 477 cloneAll( other.dtors, dtors ); 478 } 479 480 ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() { 481 delete callExpr; 482 deleteAll( tempDecls ); 483 deleteAll( returnDecls ); 484 deleteAll( dtors ); 485 } 486 487 void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const { 488 os << std::string( indent, ' ' ) << "Implicit Copy Constructor Expression: " << std::endl; 489 assert( callExpr ); 490 callExpr->print( os, indent + 2 ); 491 os << std::endl << std::string( indent, ' ' ) << "with temporaries:" << std::endl; 492 printAll(tempDecls, os, indent+2); 493 os << std::endl << std::string( indent, ' ' ) << "with return temporaries:" << std::endl; 494 printAll(returnDecls, os, indent+2); 495 Expression::print( os, indent ); 496 } 497 435 498 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {} 436 499
Note:
See TracChangeset
for help on using the changeset viewer.