Changeset 6635c74 for src/GenPoly
- Timestamp:
- Mar 7, 2016, 1:37:42 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:
- 4e284ea6
- Parents:
- 2e60a1a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r2e60a1a r6635c74 26 26 #include "PolyMutator.h" 27 27 #include "FindFunction.h" 28 #include "ScopedMap.h" 28 29 #include "ScrubTyVars.h" 29 30 … … 112 113 ObjectDecl *makeTemporary( Type *type ); 113 114 114 typedef std::map< std::string, DeclarationWithType *> AdapterMap;115 115 std::map< std::string, DeclarationWithType *> assignOps; 116 116 ResolvExpr::TypeMap< DeclarationWithType > scopedAssignOps; 117 std::stack< AdapterMap> adapters;117 ScopedMap< std::string, DeclarationWithType* > adapters; 118 118 DeclarationWithType *retval; 119 119 bool useRetval; … … 448 448 } 449 449 450 Pass1::Pass1() : useRetval( false ), tempNamer( "_temp" ) { 451 adapters.push(AdapterMap()); 452 } 450 Pass1::Pass1() : useRetval( false ), tempNamer( "_temp" ) {} 453 451 454 452 /// Returns T if the given declaration is (*?=?)(T *, T) for some TypeInstType T (return not checked, but maybe should be), NULL otherwise … … 553 551 } // for 554 552 555 AdapterMap & adapters = Pass1::adapters.top();556 553 for ( std::list< FunctionType *>::iterator funType = functions.begin(); funType != functions.end(); ++funType ) { 557 554 std::string mangleName = mangleAdapterName( *funType, scopeTyVars ); … … 975 972 mangleName += makePolyMonoSuffix( originalFunction, exprTyVars ); 976 973 977 AdapterMap & adapters = Pass1::adapters.top();978 Adapter Map::iterator adapter = adapters.find( mangleName );974 typedef ScopedMap< std::string, DeclarationWithType* >::iterator AdapterIter; 975 AdapterIter adapter = adapters.find( mangleName ); 979 976 if ( adapter == adapters.end() ) { 980 977 // adapter has not been created yet in the current scope, so define it 981 978 FunctionDecl *newAdapter = makeAdapter( *funType, realFunction, mangleName, exprTyVars ); 982 adapter = adapters.insert( adapters.begin(), std::pair< std::string, DeclarationWithType *>( mangleName, newAdapter ) ); 979 std::pair< AdapterIter, bool > answer = adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, newAdapter ) ); 980 adapter = answer.first; 983 981 stmtsToAdd.push_back( new DeclStmt( noLabels, newAdapter ) ); 984 982 } // if … … 1359 1357 1360 1358 void Pass1::doBeginScope() { 1361 // push a copy of the current map 1362 adapters.push(adapters.top()); 1359 adapters.beginScope(); 1363 1360 scopedAssignOps.beginScope(); 1364 1361 } 1365 1362 1366 1363 void Pass1::doEndScope() { 1367 adapters. pop();1364 adapters.endScope(); 1368 1365 scopedAssignOps.endScope(); 1369 1366 }
Note: See TracChangeset
for help on using the changeset viewer.