Changeset 22bc276 for src/CodeGen
- Timestamp:
- Sep 21, 2017, 3:23:33 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 05807e9, 29bc63e
- Parents:
- e4d6335
- git-author:
- Rob Schluntz <rschlunt@…> (09/21/17 15:19:47)
- git-committer:
- Rob Schluntz <rschlunt@…> (09/21/17 15:23:33)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
re4d6335 r22bc276 443 443 void CodeGenerator::postvisit( UntypedExpr * untypedExpr ) { 444 444 extension( untypedExpr ); 445 if ( NameExpr * nameExpr = dynamic_cast< NameExpr* >( untypedExpr-> get_function()) ) {445 if ( NameExpr * nameExpr = dynamic_cast< NameExpr* >( untypedExpr->function ) ) { 446 446 OperatorInfo opInfo; 447 if ( operatorLookup( nameExpr-> get_name(), opInfo ) ) {448 std::list< Expression* >::iterator arg = untypedExpr-> get_args().begin();447 if ( operatorLookup( nameExpr->name, opInfo ) ) { 448 std::list< Expression* >::iterator arg = untypedExpr->args.begin(); 449 449 switch ( opInfo.type ) { 450 450 case OT_INDEX: 451 assert( untypedExpr-> get_args().size() == 2 );451 assert( untypedExpr->args.size() == 2 ); 452 452 (*arg++)->accept( *visitor ); 453 453 output << "["; … … 461 461 case OT_CTOR: 462 462 case OT_DTOR: 463 if ( untypedExpr-> get_args().size() == 1 ) {463 if ( untypedExpr->args.size() == 1 ) { 464 464 // the expression fed into a single parameter constructor or destructor may contain side 465 465 // effects, so must still output this expression … … 480 480 (*arg++)->accept( *visitor ); 481 481 output << opInfo.symbol << "{ "; 482 genCommaList( arg, untypedExpr-> get_args().end() );482 genCommaList( arg, untypedExpr->args.end() ); 483 483 output << "}) /* " << opInfo.inputName << " */"; 484 484 } // if … … 488 488 case OT_PREFIXASSIGN: 489 489 case OT_LABELADDRESS: 490 assert( untypedExpr-> get_args().size() == 1 );490 assert( untypedExpr->args.size() == 1 ); 491 491 output << "("; 492 492 output << opInfo.symbol; … … 497 497 case OT_POSTFIX: 498 498 case OT_POSTFIXASSIGN: 499 assert( untypedExpr-> get_args().size() == 1 );499 assert( untypedExpr->args.size() == 1 ); 500 500 (*arg)->accept( *visitor ); 501 501 output << opInfo.symbol; … … 504 504 case OT_INFIX: 505 505 case OT_INFIXASSIGN: 506 assert( untypedExpr-> get_args().size() == 2 );506 assert( untypedExpr->args.size() == 2 ); 507 507 output << "("; 508 508 (*arg++)->accept( *visitor ); … … 517 517 } // switch 518 518 } else { 519 if ( nameExpr->get_name() == "..." ) { // case V1 ... V2 or case V1~V2 520 assert( untypedExpr->get_args().size() == 2 ); 521 (*untypedExpr->get_args().begin())->accept( *visitor ); 522 output << " ... "; 523 (*--untypedExpr->get_args().end())->accept( *visitor ); 524 } else { // builtin routines 525 nameExpr->accept( *visitor ); 526 output << "("; 527 genCommaList( untypedExpr->get_args().begin(), untypedExpr->get_args().end() ); 528 output << ")"; 529 } // if 519 // builtin routines 520 nameExpr->accept( *visitor ); 521 output << "("; 522 genCommaList( untypedExpr->args.begin(), untypedExpr->args.end() ); 523 output << ")"; 530 524 } // if 531 525 } else { 532 untypedExpr-> get_function()->accept( *visitor );526 untypedExpr->function->accept( *visitor ); 533 527 output << "("; 534 genCommaList( untypedExpr-> get_args().begin(), untypedExpr->get_args().end() );528 genCommaList( untypedExpr->args.begin(), untypedExpr->args.end() ); 535 529 output << ")"; 536 530 } // if … … 538 532 539 533 void CodeGenerator::postvisit( RangeExpr * rangeExpr ) { 540 rangeExpr-> get_low()->accept( *visitor );534 rangeExpr->low->accept( *visitor ); 541 535 output << " ... "; 542 rangeExpr-> get_high()->accept( *visitor );536 rangeExpr->high->accept( *visitor ); 543 537 } 544 538
Note: See TracChangeset
for help on using the changeset viewer.