Changeset 1cf2a9b for src/ResolvExpr/Resolver.cc
- Timestamp:
- Jun 18, 2020, 4:57:23 PM (4 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:
- 8ff586c
- Parents:
- c7f834e (diff), e068c8a (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
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
rc7f834e r1cf2a9b 1299 1299 // default value expressions have an environment which shouldn't be there and trips up 1300 1300 // 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 } 1301 assert( functionDecl->unique() ); 1302 ast::FunctionType * mutType = mutate( functionDecl->type.get() ); 1303 1304 for ( unsigned i = 0 ; i < mutType->params.size() ; ++i ) { 1305 if ( const ast::ObjectDecl * obj = mutType->params[i].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 auto mutParam = mutate( mutType->params[i].strict_as< ast::ObjectDecl >() ); 1310 auto mutInit = mutate( mutParam->init.strict_as< ast::SingleInit >() ); 1311 auto mutValue = mutate( mutInit->value.get() ); 1312 1313 mutValue->env = nullptr; 1314 mutInit->value = mutValue; 1315 mutParam->init = mutInit; 1316 mutType->params[i] = mutParam; 1317 1318 assert( ! mutType->params[i].strict_as< ast::ObjectDecl >()->init.strict_as< ast::SingleInit >()->value->env); 1319 } 1320 } 1334 1321 } 1335 1322 mutate_field(functionDecl, &ast::FunctionDecl::type, mutType);
Note: See TracChangeset
for help on using the changeset viewer.