Changeset 17cd4eb for translator/ResolvExpr
- Timestamp:
- Jan 7, 2015, 6:04:42 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:
- 0b8cd722
- Parents:
- d9a0e76
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/ResolvExpr/Resolver.cc
rd9a0e76 r17cd4eb 47 47 (*i)->print( std::cerr ); 48 48 (*i)->accept( resolver ); 49 } 49 } // for 50 50 #endif 51 51 } … … 81 81 for ( std::list< Alternative >::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) { 82 82 i->print( std::cout ); 83 } 84 } 83 } // for 84 } // if 85 85 #endif 86 86 assert( finder.get_alternatives().size() == 1 ); … … 98 98 } else { 99 99 return true; 100 } 100 } // if 101 101 } 102 102 … … 112 112 for ( std::list< Alternative >::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) { 113 113 i->print( std::cout ); 114 } 115 } 114 } // for 115 } // if 116 116 #endif 117 117 Expression *newExpr = 0; … … 124 124 newExpr = i->expr->clone(); 125 125 newEnv = &i->env; 126 } 127 } 128 } 126 } // if 127 } // if 128 } // for 129 129 if ( !newExpr ) { 130 130 throw SemanticError( "Too many interpretations for switch control expression", untyped ); 131 } 131 } // if 132 132 finishExpr( newExpr, *newEnv ); 133 133 return newExpr; … … 147 147 Type *new_type = resolveTypeof( typeDecl->get_base(), *this ); 148 148 typeDecl->set_base( new_type ); 149 } 149 } // if 150 150 SymTab::Indexer::visit( typeDecl ); 151 151 } … … 163 163 for ( std::list< DeclarationWithType * >::const_iterator i = functionDecl->get_functionType()->get_returnVals().begin(); i != functionDecl->get_functionType()->get_returnVals().end(); ++i ) { 164 164 functionReturn.push_back( (*i)->get_type() ); 165 } 165 } // for 166 166 SymTab::Indexer::visit( functionDecl ); 167 167 functionReturn = oldFunctionReturn; … … 173 173 delete exprStmt->get_expr(); 174 174 exprStmt->set_expr( newExpr ); 175 } 175 } // if 176 176 } 177 177 … … 196 196 delete forStmt->get_condition(); 197 197 forStmt->set_condition( newExpr ); 198 } 198 } // if 199 199 200 200 if ( forStmt->get_increment() ) { … … 202 202 delete forStmt->get_increment(); 203 203 forStmt->set_increment( newExpr ); 204 } 204 } // if 205 205 206 206 Visitor::visit( forStmt ); … … 236 236 delete castExpr; 237 237 returnStmt->set_expr( newExpr ); 238 } 238 } // if 239 239 } 240 240 241 241 void Resolver::visit( SingleInit *singleInit ) { 242 //if ( singleInit->get_value() ) {243 //CastExpr *castExpr = new CastExpr( singleInit->get_value(), initContext->clone() );244 //Expression *newExpr = findSingleExpression( castExpr, *this );245 //delete castExpr;246 //singleInit->set_value( newExpr );247 // }248 //singleInit->get_value()->accept( *this );242 if ( singleInit->get_value() ) { 243 CastExpr *castExpr = new CastExpr( singleInit->get_value(), initContext->clone() ); 244 Expression *newExpr = findSingleExpression( castExpr, *this ); 245 delete castExpr; 246 singleInit->set_value( newExpr ); 247 } // if 248 singleInit->get_value()->accept( *this ); 249 249 } 250 250
Note: See TracChangeset
for help on using the changeset viewer.