Changeset 4c925cd for src/ResolvExpr/Resolver.cc
- Timestamp:
- Aug 14, 2020, 11:40:04 AM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 5715d43, fa5e0112
- Parents:
- 309d814 (diff), badd22f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
src/ResolvExpr/Resolver.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
r309d814 r4c925cd 982 982 ast::Pass<DeleteFinder_new> finder; 983 983 expr->accept( finder ); 984 return finder. pass.delExpr;984 return finder.core.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 mutate( const ast::CastExpr * castExpr ) {1074 const ast::Expr * postvisit( const ast::CastExpr * castExpr ) { 1075 1075 if ( 1076 castExpr->isGenerated 1076 castExpr->isGenerated == ast::GeneratedCast 1077 1077 && typesCompatible( castExpr->arg->result, castExpr->result ) 1078 1078 ) { … … 1128 1128 1129 1129 // set up and resolve expression cast to void 1130 ast:: CastExpr *untyped = new ast::CastExpr{ expr };1130 ast::ptr< 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; 1238 1239 Resolver_new() = default; 1239 1240 Resolver_new( const ast::SymbolTable & syms ) { symtab = syms; } … … 1266 1267 const ast::ConstructorInit * previsit( const ast::ConstructorInit * ); 1267 1268 }; 1268 1269 void resolve( std::list< ast::ptr<ast::Decl> >& translationUnit ) { 1270 ast::Pass< Resolver_new > resolver;1271 a ccept_all( translationUnit, resolver);1269 // size_t Resolver_new::traceId = Stats::Heap::new_stacktrace_id("Resolver"); 1270 1271 void resolve( std::list< ast::ptr< ast::Decl > >& translationUnit ) { 1272 ast::Pass< Resolver_new >::run( translationUnit ); 1272 1273 } 1273 1274 … … 1299 1300 // default value expressions have an environment which shouldn't be there and trips up 1300 1301 // later passes. 1301 as t::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 >() ) {1302 assert( 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 >() ) { 1306 1307 if ( const ast::SingleInit * init = obj->init.as< ast::SingleInit >() ) { 1307 1308 if ( init->value->env == nullptr ) continue; 1308 1309 // 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 ); 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); 1317 1320 } 1318 1321 } 1319 1322 } 1320 return ret.get(); 1323 mutate_field(functionDecl, &ast::FunctionDecl::type, mutType); 1324 return functionDecl; 1321 1325 } 1322 1326 … … 1341 1345 // in case we decide to allow nested enums 1342 1346 GuardValue( inEnumDecl ); 1343 inEnumDecl = false;1347 inEnumDecl = true; 1344 1348 } 1345 1349
Note:
See TracChangeset
for help on using the changeset viewer.