Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    rb128d3e rd180746  
    187187
    188188                        UntypedExpr * increment = new UntypedExpr( new NameExpr( "++?" ) );
    189                         increment->get_args().push_back( index->clone() );
     189                        increment->get_args().push_back( new AddressExpr( index->clone() ) );
    190190                        *out++ = new ExprStmt( noLabels, increment );
    191191                }
     
    325325                        std::string name = getFunctionName( expr );
    326326                        assertf( name == "*?", "Unexpected untyped expression: %s", name.c_str() );
    327                         assertf( ! expr->get_args().empty(), "Cannot get called function from dereference with no arguments" );
     327                        assertf( ! expr->get_args().empty(), "Can't get called function from dereference with no arguments" );
    328328                        return getCalledFunction( expr->get_args().front() );
    329329                }
     
    397397                template<typename CallExpr>
    398398                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?" );
    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 );
    422420                } else {
    423421                        assertf( false, "Unexpected expression type passed to getCallArg: %s", toString( callExpr ).c_str() );
     
    433431                        std::string name = getFunctionName( expr );
    434432                        assertf( name == "*?", "Unexpected untyped expression: %s", name.c_str() );
    435                         assertf( ! expr->get_args().empty(), "Cannot get function name from dereference with no arguments" );
     433                        assertf( ! expr->get_args().empty(), "Can't get function name from dereference with no arguments" );
    436434                        return funcName( expr->get_args().front() );
    437435                }
     
    452450                        } else if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( func ) ) {
    453451                                return handleDerefName( appExpr );
    454                         } else if ( ConstructorExpr * ctorExpr = dynamic_cast< ConstructorExpr * >( func ) ) {
    455                                 return funcName( getCallArg( ctorExpr->get_callExpr(), 0 ) );
    456452                        } 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" );
    458454                        }
    459455                }
     
    479475                } else if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) {
    480476                        return arrayType->get_base();
    481                 } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( type ) ) {
    482                         return refType->get_base();
    483477                } else {
    484478                        return NULL;
     
    566560                if ( ftype->get_parameters().size() != 2 ) return 0;
    567561
    568                 Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type() );
     562                Type * t1 = ftype->get_parameters().front()->get_type();
    569563                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() ) ) {
    573568                        return function;
    574569                } else {
Note: See TracChangeset for help on using the changeset viewer.