Changes in src/SynTree/Expression.cc [4ffdd63:630a82a]
- File:
-
- 1 edited
-
src/SynTree/Expression.cc (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r4ffdd63 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 Apr 27 17:07:19201611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Apr 8 17:16:23 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() );83 81 add_result( var->get_type()->clone() ); 84 82 for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) { … … 95 93 96 94 void VariableExpr::print( std::ostream &os, int indent ) const { 97 os << "Variable Expression: ";95 os << std::string( indent, ' ' ) << "Variable Expression: "; 98 96 99 97 Declaration *decl = get_var(); … … 124 122 125 123 void SizeofExpr::print( std::ostream &os, int indent) const { 126 os << "Sizeof Expression on: ";124 os << std::string( indent, ' ' ) << "Sizeof Expression on: "; 127 125 128 126 if (isType) … … 225 223 } 226 224 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 248 225 AttrExpr::AttrExpr( Expression *attr, Expression *expr_, Expression *_aname ) : 249 226 Expression( _aname ), attr( attr ), expr(expr_), type(0), isType(false) { … … 297 274 298 275 void CastExpr::print( std::ostream &os, int indent ) const { 299 os << "Cast of:" << std::endl << std::string( indent+2, ' ' );276 os << std::string( indent, ' ' ) << "Cast of:" << std::endl; 300 277 arg->print(os, indent+2); 301 278 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; … … 320 297 321 298 void UntypedMemberExpr::print( std::ostream &os, int indent ) const { 322 os << "UntypedMember Expression, with field: " << get_member();299 os << std::string( indent, ' ' ) << "Member Expression, with field: " << get_member(); 323 300 324 301 Expression *agg = get_aggregate(); 325 302 os << std::string( indent, ' ' ) << "from aggregate: "; 326 if (agg != 0) { 327 os << std::string( indent+2, ' ' ); 328 agg->print(os, indent + 2); 329 } 330 os << std::string( indent+2, ' ' ); 303 if (agg != 0) agg->print(os, indent + 2); 331 304 Expression::print( os, indent ); 332 305 } … … 351 324 352 325 void MemberExpr::print( std::ostream &os, int indent ) const { 353 os << "Member Expression, with field: " << std::endl;326 os << std::string( indent, ' ' ) << "Member Expression, with field: " << std::endl; 354 327 355 328 assert( member ); … … 360 333 Expression *agg = get_aggregate(); 361 334 os << std::string( indent, ' ' ) << "from aggregate: " << std::endl; 362 if (agg != 0) { 363 os << std::string( indent+2, ' ' ); 364 agg->print(os, indent + 2); 365 } 366 os << std::string( indent+2, ' ' ); 335 if (agg != 0) agg->print(os, indent + 2); 367 336 Expression::print( os, indent ); 368 337 } … … 382 351 383 352 void UntypedExpr::print( std::ostream &os, int indent ) const { 384 os << "Applying untyped: " << std::endl; 385 os << std::string( indent, ' ' ); 353 os << std::string( indent, ' ' ) << "Applying untyped: " << std::endl; 386 354 function->print(os, indent + 4); 387 355 os << std::string( indent, ' ' ) << "...to: " << std::endl; 388 os << std::string( indent, ' ' );389 356 printArgs(os, indent + 4); 390 357 Expression::print( os, indent ); … … 405 372 406 373 void NameExpr::print( std::ostream &os, int indent ) const { 407 os << "Name: " << get_name() << std::endl;374 os << std::string( indent, ' ' ) << "Name: " << get_name() << std::endl; 408 375 Expression::print( os, indent ); 409 376 } … … 466 433 } 467 434 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 498 435 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {} 499 436
Note:
See TracChangeset
for help on using the changeset viewer.