Changes in src/InitTweak/InitTweak.cc [b128d3e:d180746]
- File:
-
- 1 edited
-
src/InitTweak/InitTweak.cc (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/InitTweak.cc
rb128d3e rd180746 187 187 188 188 UntypedExpr * increment = new UntypedExpr( new NameExpr( "++?" ) ); 189 increment->get_args().push_back( index->clone() );189 increment->get_args().push_back( new AddressExpr( index->clone() ) ); 190 190 *out++ = new ExprStmt( noLabels, increment ); 191 191 } … … 325 325 std::string name = getFunctionName( expr ); 326 326 assertf( name == "*?", "Unexpected untyped expression: %s", name.c_str() ); 327 assertf( ! expr->get_args().empty(), "Can not get called function from dereference with no arguments" );327 assertf( ! expr->get_args().empty(), "Can't get called function from dereference with no arguments" ); 328 328 return getCalledFunction( expr->get_args().front() ); 329 329 } … … 397 397 template<typename CallExpr> 398 398 Expression *& callArg( CallExpr * callExpr, unsigned int pos ) { 399 if ( pos >= callExpr->get_args().size() ) assertf( false, " getCallArg for argument that doesn't exist: (%u); %s.", pos, toString( callExpr ).c_str());399 if ( pos >= callExpr->get_args().size() ) assertf( false, "asking for argument that doesn't exist. Return NULL/throw exception?" ); 400 400 for ( Expression *& arg : callExpr->get_args() ) { 401 401 if ( pos == 0 ) return arg; … … 418 418 assertf( ! tuple->get_exprs().empty(), "TupleAssignExpr somehow has empty tuple expr." ); 419 419 return getCallArg( tuple->get_exprs().front(), pos ); 420 } else if ( ImplicitCopyCtorExpr * copyCtor = dynamic_cast< ImplicitCopyCtorExpr * >( callExpr ) ) {421 return getCallArg( copyCtor->callExpr, pos );422 420 } else { 423 421 assertf( false, "Unexpected expression type passed to getCallArg: %s", toString( callExpr ).c_str() ); … … 433 431 std::string name = getFunctionName( expr ); 434 432 assertf( name == "*?", "Unexpected untyped expression: %s", name.c_str() ); 435 assertf( ! expr->get_args().empty(), "Can not get function name from dereference with no arguments" );433 assertf( ! expr->get_args().empty(), "Can't get function name from dereference with no arguments" ); 436 434 return funcName( expr->get_args().front() ); 437 435 } … … 452 450 } else if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( func ) ) { 453 451 return handleDerefName( appExpr ); 454 } else if ( ConstructorExpr * ctorExpr = dynamic_cast< ConstructorExpr * >( func ) ) {455 return funcName( getCallArg( ctorExpr->get_callExpr(), 0 ) );456 452 } else { 457 assertf( false, "Unexpected expression type being called as a function in call expression : %s", toString( func ).c_str());453 assertf( false, "Unexpected expression type being called as a function in call expression" ); 458 454 } 459 455 } … … 479 475 } else if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) { 480 476 return arrayType->get_base(); 481 } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( type ) ) {482 return refType->get_base();483 477 } else { 484 478 return NULL; … … 566 560 if ( ftype->get_parameters().size() != 2 ) return 0; 567 561 568 Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type());562 Type * t1 = ftype->get_parameters().front()->get_type(); 569 563 Type * t2 = ftype->get_parameters().back()->get_type(); 570 assert( t1 ); 571 572 if ( ResolvExpr::typesCompatibleIgnoreQualifiers( t1, t2, SymTab::Indexer() ) ) { 564 PointerType * ptrType = dynamic_cast< PointerType * > ( t1 ); 565 assert( ptrType ); 566 567 if ( ResolvExpr::typesCompatibleIgnoreQualifiers( ptrType->get_base(), t2, SymTab::Indexer() ) ) { 573 568 return function; 574 569 } else {
Note:
See TracChangeset
for help on using the changeset viewer.