Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    rd180746 r62a05d1  
    187187
    188188                        UntypedExpr * increment = new UntypedExpr( new NameExpr( "++?" ) );
    189                         increment->get_args().push_back( new AddressExpr( index->clone() ) );
     189                        increment->get_args().push_back( index->clone() );
    190190                        *out++ = new ExprStmt( noLabels, increment );
    191191                }
     
    397397                template<typename CallExpr>
    398398                Expression *& callArg( CallExpr * callExpr, unsigned int pos ) {
    399                         if ( pos >= callExpr->get_args().size() ) assertf( false, "asking for argument that doesn't exist. Return NULL/throw exception?" );
     399                        if ( pos >= callExpr->get_args().size() ) assertf( false, "getCallArg for argument that doesn't exist: (%u); %s.", pos, toString( callExpr ).c_str() );
    400400                        for ( Expression *& arg : callExpr->get_args() ) {
    401401                                if ( pos == 0 ) return arg;
     
    418418                        assertf( ! tuple->get_exprs().empty(), "TupleAssignExpr somehow has empty tuple expr." );
    419419                        return getCallArg( tuple->get_exprs().front(), pos );
     420                } else if ( ImplicitCopyCtorExpr * copyCtor = dynamic_cast< ImplicitCopyCtorExpr * >( callExpr ) ) {
     421                        return getCallArg( copyCtor->callExpr, pos );
    420422                } else {
    421423                        assertf( false, "Unexpected expression type passed to getCallArg: %s", toString( callExpr ).c_str() );
     
    450452                        } else if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( func ) ) {
    451453                                return handleDerefName( appExpr );
     454                        } else if ( ConstructorExpr * ctorExpr = dynamic_cast< ConstructorExpr * >( func ) ) {
     455                                return funcName( getCallArg( ctorExpr->get_callExpr(), 0 ) );
    452456                        } else {
    453                                 assertf( false, "Unexpected expression type being called as a function in call expression" );
     457                                assertf( false, "Unexpected expression type being called as a function in call expression: %s", toString( func ).c_str() );
    454458                        }
    455459                }
     
    475479                } else if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) {
    476480                        return arrayType->get_base();
     481                } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( type ) ) {
     482                        return refType->get_base();
    477483                } else {
    478484                        return NULL;
     
    560566                if ( ftype->get_parameters().size() != 2 ) return 0;
    561567
    562                 Type * t1 = ftype->get_parameters().front()->get_type();
     568                Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type() );
    563569                Type * t2 = ftype->get_parameters().back()->get_type();
    564                 PointerType * ptrType = dynamic_cast< PointerType * > ( t1 );
    565                 assert( ptrType );
    566 
    567                 if ( ResolvExpr::typesCompatibleIgnoreQualifiers( ptrType->get_base(), t2, SymTab::Indexer() ) ) {
     570                assert( t1 );
     571
     572                if ( ResolvExpr::typesCompatibleIgnoreQualifiers( t1, t2, SymTab::Indexer() ) ) {
    568573                        return function;
    569574                } else {
Note: See TracChangeset for help on using the changeset viewer.