Changeset 2c2242c for translator/ResolvExpr
- Timestamp:
- Jan 24, 2015, 5:34:52 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 26a07a22
- Parents:
- fe3b61b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/ResolvExpr/Resolver.cc
rfe3b61b r2c2242c 257 257 std::list<Declaration *>::iterator iter1( baseStruct->get_members().begin() ); 258 258 std::list<Initializer *>::iterator iter2( listInit->begin_initializers() ); 259 for ( ; iter1 != baseStruct->get_members().end() && iter2 != listInit->end_initializers() ; ++iter1, ++iter2 ) { 260 DeclarationWithType *dt = dynamic_cast<DeclarationWithType *>( *iter1 ); 261 initContext = dt->get_type(); 262 (*iter2)->accept( *this ); 263 } 259 for ( ; iter1 != baseStruct->get_members().end() && iter2 != listInit->end_initializers(); ++iter2 ) { 260 if ( (*iter2)->get_designators().empty() ) { 261 DeclarationWithType *dt = dynamic_cast<DeclarationWithType *>( *iter1 ); 262 initContext = dt->get_type(); 263 (*iter2)->accept( *this ); 264 ++iter1; 265 } else { 266 StructDecl *st = baseStruct; 267 iter1 = st->get_members().begin(); 268 std::list<Expression *>::iterator iter3( (*iter2)->get_designators().begin() ); 269 for ( ; iter3 != (*iter2)->get_designators().end(); ++iter3 ) { 270 NameExpr *key = dynamic_cast<NameExpr *>( *iter3 ); 271 assert( key ); 272 for ( ; iter1 != st->get_members().end(); ++iter1 ) { 273 if ( key->get_name() == (*iter1)->get_name() ) { 274 (*iter1)->print( cout ); 275 cout << key->get_name() << endl; 276 ObjectDecl *fred = dynamic_cast<ObjectDecl *>( *iter1 ); 277 assert( fred ); 278 StructInstType *mary = dynamic_cast<StructInstType*>( fred->get_type() ); 279 assert( mary ); 280 st = mary->get_baseStruct(); 281 iter1 = st->get_members().begin(); 282 break; 283 } // if 284 } // for 285 } // for 286 ObjectDecl *fred = dynamic_cast<ObjectDecl *>( *iter1 ); 287 assert( fred ); 288 initContext = fred->get_type(); 289 (*listInit->begin_initializers())->accept( *this ); 290 } // if 291 } // for 264 292 } else if ( UnionInstType *st = dynamic_cast<UnionInstType*>(initContext) ) { 265 293 DeclarationWithType *dt = dynamic_cast<DeclarationWithType *>( *st->get_baseUnion()->get_members().begin() );
Note: See TracChangeset
for help on using the changeset viewer.