Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Specialize.cc

    rb3b2077 r62e5546  
    3636        const std::list<Label> noLabels;
    3737
    38         class Specialize : public PolyMutator {
     38        class Specialize final : public PolyMutator {
    3939          public:
    4040                Specialize( std::string paramPrefix = "_p" );
    4141
    42                 virtual Expression * mutate( ApplicationExpr *applicationExpr );
    43                 virtual Expression * mutate( AddressExpr *castExpr );
    44                 virtual Expression * mutate( CastExpr *castExpr );
     42                using PolyMutator::mutate;
     43                virtual Expression * mutate( ApplicationExpr *applicationExpr ) override;
     44                virtual Expression * mutate( AddressExpr *castExpr ) override;
     45                virtual Expression * mutate( CastExpr *castExpr ) override;
    4546                // virtual Expression * mutate( LogicalExpr *logicalExpr );
    4647                // virtual Expression * mutate( ConditionalExpr *conditionalExpr );
     
    147148
    148149        Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) {
    149                 assertf( actual->has_result(), "attempting to specialize an untyped expression" );
    150                 if ( needsSpecialization( formalType, actual->get_result(), env ) ) {
     150                assert( ! actual->get_results().empty() ); // using front, should have this assert
     151                if ( needsSpecialization( formalType, actual->get_results().front(), env ) ) {
    151152                        FunctionType *funType;
    152153                        if ( ( funType = getFunctionType( formalType ) ) ) {
     
    171172        void Specialize::handleExplicitParams( ApplicationExpr *appExpr ) {
    172173                // create thunks for the explicit parameters
    173                 assert( appExpr->get_function()->has_result() );
    174                 FunctionType *function = getFunctionType( appExpr->get_function()->get_result() );
     174                assert( ! appExpr->get_function()->get_results().empty() );
     175                FunctionType *function = getFunctionType( appExpr->get_function()->get_results().front() );
    175176                assert( function );
    176177                std::list< DeclarationWithType* >::iterator formal;
     
    200201        Expression * Specialize::mutate( AddressExpr *addrExpr ) {
    201202                addrExpr->get_arg()->acceptMutator( *this );
    202                 assert( addrExpr->has_result() );
    203                 addrExpr->set_arg( doSpecialization( addrExpr->get_result(), addrExpr->get_arg() ) );
     203                assert( ! addrExpr->get_results().empty() );
     204                addrExpr->set_arg( doSpecialization( addrExpr->get_results().front(), addrExpr->get_arg() ) );
    204205                return addrExpr;
    205206        }
     
    207208        Expression * Specialize::mutate( CastExpr *castExpr ) {
    208209                castExpr->get_arg()->acceptMutator( *this );
    209                 if ( castExpr->get_result()->isVoid() ) {
     210                if ( castExpr->get_results().empty() ) {
    210211                        // can't specialize if we don't have a return value
    211212                        return castExpr;
    212213                }
    213                 Expression *specialized = doSpecialization( castExpr->get_result(), castExpr->get_arg() );
     214                Expression *specialized = doSpecialization( castExpr->get_results().front(), castExpr->get_arg() );
    214215                if ( specialized != castExpr->get_arg() ) {
    215216                        // assume here that the specialization incorporates the cast
Note: See TracChangeset for help on using the changeset viewer.