Changes in src/ResolvExpr/Resolver.cc [7ff3e522:3090127]
- File:
-
- 1 edited
-
src/ResolvExpr/Resolver.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
r7ff3e522 r3090127 982 982 ast::Pass<DeleteFinder_new> finder; 983 983 expr->accept( finder ); 984 return finder. core.delExpr;984 return finder.pass.delExpr; 985 985 } 986 986 … … 1072 1072 /// Strips extraneous casts out of an expression 1073 1073 struct StripCasts_new final { 1074 const ast::Expr * post visit( const ast::CastExpr * castExpr ) {1074 const ast::Expr * postmutate( const ast::CastExpr * castExpr ) { 1075 1075 if ( 1076 castExpr->isGenerated == ast::GeneratedCast1076 castExpr->isGenerated 1077 1077 && typesCompatible( castExpr->arg->result, castExpr->result ) 1078 1078 ) { … … 1128 1128 1129 1129 // 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 }; 1131 1131 CandidateRef choice = findUnfinishedKindExpression( 1132 1132 untyped, symtab, "", anyCandidate, ResolvMode::withAdjustment() ); … … 1236 1236 1237 1237 public: 1238 static size_t traceId;1239 1238 Resolver_new() = default; 1240 1239 Resolver_new( const ast::SymbolTable & syms ) { symtab = syms; } … … 1267 1266 const ast::ConstructorInit * previsit( const ast::ConstructorInit * ); 1268 1267 }; 1269 // size_t Resolver_new::traceId = Stats::Heap::new_stacktrace_id("Resolver"); 1270 1271 void resolve( std::list< ast::ptr< ast::Decl > >& translationUnit ) {1272 a st::Pass< Resolver_new >::run( translationUnit);1268 1269 void resolve( std::list< ast::ptr<ast::Decl> >& translationUnit ) { 1270 ast::Pass< Resolver_new > resolver; 1271 accept_all( translationUnit, resolver ); 1273 1272 } 1274 1273 … … 1300 1299 // default value expressions have an environment which shouldn't be there and trips up 1301 1300 // later passes. 1302 as sert( functionDecl->unique() );1303 ast::FunctionType * mutType = mutate( functionDecl->type.get() );1304 1305 for ( unsigned i = 0 ; i < mutType->params.size() ; ++i ) { 1306 if ( const ast::ObjectDecl * obj = mutType->params[i].as< ast::ObjectDecl >() ) {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 >() ) { 1307 1306 if ( const ast::SingleInit * init = obj->init.as< ast::SingleInit >() ) { 1308 1307 if ( init->value->env == nullptr ) continue; 1309 1308 // clone initializer minus the initializer environment 1310 auto mutParam = mutate( mutType->params[i].strict_as< ast::ObjectDecl >() ); 1311 auto mutInit = mutate( mutParam->init.strict_as< ast::SingleInit >() ); 1312 auto mutValue = mutate( mutInit->value.get() ); 1313 1314 mutValue->env = nullptr; 1315 mutInit->value = mutValue; 1316 mutParam->init = mutInit; 1317 mutType->params[i] = mutParam; 1318 1319 assert( ! mutType->params[i].strict_as< ast::ObjectDecl >()->init.strict_as< ast::SingleInit >()->value->env); 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 ); 1320 1317 } 1321 1318 } 1322 1319 } 1323 mutate_field(functionDecl, &ast::FunctionDecl::type, mutType); 1324 return functionDecl; 1320 return ret.get(); 1325 1321 } 1326 1322 … … 1345 1341 // in case we decide to allow nested enums 1346 1342 GuardValue( inEnumDecl ); 1347 inEnumDecl = true;1343 inEnumDecl = false; 1348 1344 } 1349 1345
Note:
See TracChangeset
for help on using the changeset viewer.