Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    r73973b6 r30901270  
    10741074                        const ast::Expr * postmutate( const ast::CastExpr * castExpr ) {
    10751075                                if (
    1076                                         castExpr->isGenerated == ast::GeneratedCast
     1076                                        castExpr->isGenerated
    10771077                                        && typesCompatible( castExpr->arg->result, castExpr->result )
    10781078                                ) {
     
    11281128
    11291129                // set up and resolve expression cast to void
    1130                 ast::ptr< ast::CastExpr > untyped = new ast::CastExpr{ expr };
     1130                ast::CastExpr * untyped = new ast::CastExpr{ expr };
    11311131                CandidateRef choice = findUnfinishedKindExpression(
    11321132                        untyped, symtab, "", anyCandidate, ResolvMode::withAdjustment() );
     
    12671267        };
    12681268
    1269         void resolve( std::list< ast::ptr< ast::Decl > >& translationUnit ) {
     1269        void resolve( std::list< ast::ptr<ast::Decl> >& translationUnit ) {
    12701270                ast::Pass< Resolver_new > resolver;
    12711271                accept_all( translationUnit, resolver );
     
    12991299                // default value expressions have an environment which shouldn't be there and trips up
    13001300                // later passes.
    1301 
    1302                 // ast::ptr< ast::FunctionDecl > ret = functionDecl;
    1303                 // assert(functionDecl->type->unique());
    1304                 assert(functionDecl->unique());
    1305                
    1306                 auto mutType = mutate(functionDecl->type.get());
    1307 
    1308                 for ( unsigned i = 0; i < mutType->params.size(); ++i ) {
    1309                         const ast::ptr< ast::DeclWithType > & d = mutType->params[i];
    1310             if ( const ast::ObjectDecl * obj = d.as< ast::ObjectDecl >() ) {
    1311                 if ( const ast::SingleInit * init = obj->init.as< ast::SingleInit >() ) {
    1312                     if ( init->value->env == nullptr ) continue;
    1313                     // clone initializer minus the initializer environment
    1314                     // ast::FunctionDecl * mutDecl = mutate( functionDecl );
    1315                     // auto mutType = mutate( mutDecl->type.get() );
    1316                     auto mutParam = mutate( mutType->params[i].strict_as<ast::ObjectDecl>() );
    1317                     auto mutInit = mutate( mutParam->init.strict_as<ast::SingleInit>() );
    1318                     auto mutValue = mutate( mutInit->value.get() );
    1319                     //ast::chain_mutate( ret )
    1320                     //  ( &ast::FunctionDecl::type )
    1321                     //      ( &ast::FunctionType::params )[i]
    1322                     //          ( &ast::ObjectDecl::init )
    1323                     //              ( &ast::SingleInit::value )->env = nullptr;
    1324                     // assert( functionDecl != mutDecl || functionDecl->unique() );
    1325                     mutValue->env = nullptr;
    1326                     mutInit->value = mutValue;
    1327                     mutParam->init = mutInit;
    1328                     mutType->params[i] = mutParam;
    1329                     // mutDecl->type = mutType;
    1330                     // functionDecl = mutDecl;
    1331                     assert( ! mutType->params[i].strict_as< ast::ObjectDecl >()->init.strict_as< ast::SingleInit >()->value->env);
    1332                 }
    1333             }
    1334                 }
    1335                 mutate_field(functionDecl, &ast::FunctionDecl::type, mutType);
    1336                 return functionDecl;
     1301                ast::ptr< ast::FunctionDecl > ret = functionDecl;
     1302                for ( unsigned i = 0; i < functionDecl->type->params.size(); ++i ) {
     1303                        const ast::ptr<ast::DeclWithType> & d = functionDecl->type->params[i];
     1304
     1305                        if ( const ast::ObjectDecl * obj = d.as< ast::ObjectDecl >() ) {
     1306                                if ( const ast::SingleInit * init = obj->init.as< ast::SingleInit >() ) {
     1307                                        if ( init->value->env == nullptr ) continue;
     1308                                        // clone initializer minus the initializer environment
     1309                                        ast::chain_mutate( ret )
     1310                                                ( &ast::FunctionDecl::type )
     1311                                                        ( &ast::FunctionType::params )[i]
     1312                                                                ( &ast::ObjectDecl::init )
     1313                                                                        ( &ast::SingleInit::value )->env = nullptr;
     1314
     1315                                        assert( functionDecl != ret.get() || functionDecl->unique() );
     1316                                        assert( ! ret->type->params[i].strict_as< ast::ObjectDecl >()->init.strict_as< ast::SingleInit >()->value->env );
     1317                                }
     1318                        }
     1319                }
     1320                return ret.get();
    13371321        }
    13381322
     
    13571341                // in case we decide to allow nested enums
    13581342                GuardValue( inEnumDecl );
    1359                 inEnumDecl = true;
     1343                inEnumDecl = false;
    13601344        }
    13611345
Note: See TracChangeset for help on using the changeset viewer.