Changeset bdd516a for translator/ResolvExpr/Resolver.cc
- Timestamp:
- Apr 28, 2015, 4:21:36 PM (9 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:
- 42e2ad7
- Parents:
- ad17ba6a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/ResolvExpr/Resolver.cc
rad17ba6a rbdd516a 44 44 acceptAll( translationUnit, resolver ); 45 45 #if 0 46 resolver.print( cerr ); 46 47 for ( std::list< Declaration * >::iterator i = translationUnit.begin(); i != translationUnit.end(); ++i ) { 47 48 (*i)->print( std::cerr ); … … 241 242 void Resolver::visit( SingleInit *singleInit ) { 242 243 if ( singleInit->get_value() ) { 244 #if 0 245 if (NameExpr * ne = dynamic_cast<NameExpr*>(singleInit->get_value())) { 246 string n = ne->get_name(); 247 if (n == "0") { 248 initContext = new BasicType(Type::Qualifiers(), 249 BasicType::SignedInt); 250 } else { 251 DeclarationWithType * decl = lookupId(n); 252 initContext = decl->get_type(); 253 } 254 } else if (ConstantExpr * e = 255 dynamic_cast<ConstantExpr*>(singleInit->get_value())) { 256 Constant *c = e->get_constant(); 257 initContext = c->get_type(); 258 } else { 259 assert(0); 260 } 261 #endif 243 262 CastExpr *castExpr = new CastExpr( singleInit->get_value(), initContext->clone() ); 244 263 Expression *newExpr = findSingleExpression( castExpr, *this ); … … 250 269 251 270 void Resolver::visit( ListInit *listInit ) { 271 Visitor::visit(listInit); 272 #if 0 252 273 if ( ArrayType *at = dynamic_cast<ArrayType*>(initContext) ) { 253 initContext = at->get_base(); 254 Visitor::visit( listInit ); 274 std::list<Initializer *>::iterator iter( listInit->begin_initializers() ); 275 for ( ; iter != listInit->end_initializers(); ++iter ) { 276 initContext = at->get_base(); 277 (*iter)->accept( *this ); 278 } // for 255 279 } else if ( StructInstType *st = dynamic_cast<StructInstType*>(initContext) ) { 256 280 StructDecl *baseStruct = st->get_baseStruct(); … … 295 319 (*listInit->begin_initializers())->accept( *this ); 296 320 } // if 321 #endif 297 322 } 298 323 } // namespace ResolvExpr
Note: See TracChangeset
for help on using the changeset viewer.