Changeset a32b204 for translator/Tuples/NameMatcher.cc
- Timestamp:
- May 17, 2015, 1:19:35 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:
- 0dd3a2f
- Parents:
- b87a5ed
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/Tuples/NameMatcher.cc
rb87a5ed ra32b204 6 6 : current( 0 ) { 7 7 int cnt = 0; 8 for ( std::list< DeclarationWithType *>::const_iterator f = formals.begin(); f != formals.end(); ++f ) {8 for ( std::list< DeclarationWithType *>::const_iterator f = formals.begin(); f != formals.end(); ++f ) { 9 9 table.insert( std::pair< std::string, int >( (*f)->get_name(), cnt++ ) ); 10 10 index.push_back(*f); … … 16 16 17 17 void NameMatcher::match( ResolvExpr::AltList &alternatives ) throw (NoMatch) { 18 if ( alternatives.size() != index.size() )18 if ( alternatives.size() != index.size() ) 19 19 throw NoMatch("Length of actuals and formals differ"); 20 20 21 for ( ResolvExpr::AltList::const_iterator a = alternatives.begin(); a != alternatives.end(); ++a ) {22 if ( a->expr->get_argName() != 0 )21 for ( ResolvExpr::AltList::const_iterator a = alternatives.begin(); a != alternatives.end(); ++a ) { 22 if ( a->expr->get_argName() != 0 ) 23 23 if ( NameExpr *name = dynamic_cast<NameExpr *>( a->expr->get_argName() ) ) { 24 24 if ( table.find( name->get_name() ) != table.end() ) { … … 27 27 } else 28 28 throw NoMatch( name->get_name() + "no such designation" ); 29 } /*else if ( TupleExpr *tup = dynamic_cast<TupleExpr *>( a->expr->get_argName() ) )29 } /*else if ( TupleExpr *tup = dynamic_cast<TupleExpr *>( a->expr->get_argName() ) ) 30 30 std::cerr << "Designated expression" << std::endl; */ 31 31 exprs.push_back( &(*a) ); … … 41 41 42 42 ResolvExpr::Alternative &NameMatcher::get_next() throw (NoMoreElements) { 43 if ( current++ >= (int)(index.size()) )43 if ( current++ >= (int)(index.size()) ) 44 44 throw NoMoreElements(); 45 45 return *(new ResolvExpr::Alternative());
Note: See TracChangeset
for help on using the changeset viewer.