Changes in src/SynTree/Expression.cc [9243a501:630a82a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r9243a501 r630a82a 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed May 04 12:14:09201611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Apr 8 17:16:23 2016 13 13 // Update Count : 40 14 14 // … … 72 72 73 73 void ConstantExpr::print( std::ostream &os, int indent ) const { 74 os << "constant expression " ;74 os << std::string( indent, ' ' ) << "constant expression " ; 75 75 constant.print( os ); 76 76 Expression::print( os, indent ); … … 93 93 94 94 void VariableExpr::print( std::ostream &os, int indent ) const { 95 os << "Variable Expression: ";95 os << std::string( indent, ' ' ) << "Variable Expression: "; 96 96 97 97 Declaration *decl = get_var(); … … 122 122 123 123 void SizeofExpr::print( std::ostream &os, int indent) const { 124 os << "Sizeof Expression on: ";124 os << std::string( indent, ' ' ) << "Sizeof Expression on: "; 125 125 126 126 if (isType) … … 223 223 } 224 224 225 OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) {226 add_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );227 }228 229 OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {}230 231 OffsetPackExpr::~OffsetPackExpr() { delete type; }232 233 void OffsetPackExpr::print( std::ostream &os, int indent ) const {234 os << std::string( indent, ' ' ) << "Offset pack expression on ";235 236 if ( type ) {237 type->print(os, indent + 2);238 } else {239 os << "<NULL>";240 }241 242 os << std::endl;243 Expression::print( os, indent );244 }245 246 225 AttrExpr::AttrExpr( Expression *attr, Expression *expr_, Expression *_aname ) : 247 226 Expression( _aname ), attr( attr ), expr(expr_), type(0), isType(false) { … … 295 274 296 275 void CastExpr::print( std::ostream &os, int indent ) const { 297 os << "Cast of:" << std::endl << std::string( indent+2, ' ' );276 os << std::string( indent, ' ' ) << "Cast of:" << std::endl; 298 277 arg->print(os, indent+2); 299 278 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; … … 318 297 319 298 void UntypedMemberExpr::print( std::ostream &os, int indent ) const { 320 os << "UntypedMember Expression, with field: " << get_member();299 os << std::string( indent, ' ' ) << "Member Expression, with field: " << get_member(); 321 300 322 301 Expression *agg = get_aggregate(); 323 os << ", from aggregate: "; 324 if (agg != 0) { 325 agg->print(os, indent + 2); 326 } 327 os << std::string( indent+2, ' ' ); 302 os << std::string( indent, ' ' ) << "from aggregate: "; 303 if (agg != 0) agg->print(os, indent + 2); 328 304 Expression::print( os, indent ); 329 305 } … … 348 324 349 325 void MemberExpr::print( std::ostream &os, int indent ) const { 350 os << "Member Expression, with field: " << std::endl;326 os << std::string( indent, ' ' ) << "Member Expression, with field: " << std::endl; 351 327 352 328 assert( member ); … … 357 333 Expression *agg = get_aggregate(); 358 334 os << std::string( indent, ' ' ) << "from aggregate: " << std::endl; 359 if (agg != 0) { 360 agg->print(os, indent + 2); 361 } 362 os << std::string( indent+2, ' ' ); 335 if (agg != 0) agg->print(os, indent + 2); 363 336 Expression::print( os, indent ); 364 337 } … … 378 351 379 352 void UntypedExpr::print( std::ostream &os, int indent ) const { 380 os << "Applying untyped: " << std::endl; 381 os << std::string( indent+4, ' ' ); 353 os << std::string( indent, ' ' ) << "Applying untyped: " << std::endl; 382 354 function->print(os, indent + 4); 383 355 os << std::string( indent, ' ' ) << "...to: " << std::endl; 384 printA ll(args,os, indent + 4);356 printArgs(os, indent + 4); 385 357 Expression::print( os, indent ); 386 358 } … … 388 360 void UntypedExpr::printArgs( std::ostream &os, int indent ) const { 389 361 std::list<Expression *>::const_iterator i; 390 for (i = args.begin(); i != args.end(); i++) { 391 os << std::string(indent, ' ' ); 362 for (i = args.begin(); i != args.end(); i++) 392 363 (*i)->print(os, indent); 393 }394 364 } 395 365 … … 402 372 403 373 void NameExpr::print( std::ostream &os, int indent ) const { 404 os << "Name: " << get_name() << std::endl;374 os << std::string( indent, ' ' ) << "Name: " << get_name() << std::endl; 405 375 Expression::print( os, indent ); 406 376 }
Note: See TracChangeset
for help on using the changeset viewer.