Changeset a08ba92 for translator/SymTab/StackTable.cc
- Timestamp:
- May 19, 2015, 4:58:14 PM (11 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:
- 843054c2
- Parents:
- 01aeade
- File:
-
- 1 edited
-
translator/SymTab/StackTable.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
translator/SymTab/StackTable.cc
r01aeade ra08ba92 10 10 // Created On : Sun May 17 21:45:15 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun May 17 21:46:59201513 // Update Count : 212 // Last Modified On : Tue May 19 16:51:53 2015 13 // Update Count : 3 14 14 // 15 15 … … 19 19 20 20 namespace SymTab { 21 template< typename Element, typename ConflictFunction >22 StackTable< Element, ConflictFunction >::StackTable() : scopeLevel( 0 ) {21 template< typename Element, typename ConflictFunction > 22 StackTable< Element, ConflictFunction >::StackTable() : scopeLevel( 0 ) { 23 23 } 24 24 25 template< typename Element, typename ConflictFunction >26 void StackTable< Element, ConflictFunction >::enterScope() {25 template< typename Element, typename ConflictFunction > 26 void StackTable< Element, ConflictFunction >::enterScope() { 27 27 scopeLevel++; 28 }28 } 29 29 30 template< typename Element, typename ConflictFunction >31 void StackTable< Element, ConflictFunction >::leaveScope() {30 template< typename Element, typename ConflictFunction > 31 void StackTable< Element, ConflictFunction >::leaveScope() { 32 32 for ( typename TableType::iterator it = table.begin(); it != table.end(); ++it ) { 33 33 std::stack< Entry >& entry = it->second; … … 38 38 scopeLevel--; 39 39 assert( scopeLevel >= 0 ); 40 }40 } 41 41 42 template< typename Element, typename ConflictFunction >43 void StackTable< Element, ConflictFunction >::add( Element *type ) {42 template< typename Element, typename ConflictFunction > 43 void StackTable< Element, ConflictFunction >::add( Element *type ) { 44 44 std::stack< Entry >& entry = table[ type->get_name() ]; 45 45 if ( ! entry.empty() && entry.top().second == scopeLevel ) { … … 48 48 entry.push( Entry( type, scopeLevel ) ); 49 49 } // if 50 }50 } 51 51 52 template< typename Element, typename ConflictFunction >53 void StackTable< Element, ConflictFunction >::add( std::string fwdDeclName ) {52 template< typename Element, typename ConflictFunction > 53 void StackTable< Element, ConflictFunction >::add( std::string fwdDeclName ) { 54 54 add( new Element( fwdDeclName ) ); 55 }55 } 56 56 57 template< typename Element, typename ConflictFunction >58 Element *StackTable< Element, ConflictFunction >::lookup( std::string id ) const {57 template< typename Element, typename ConflictFunction > 58 Element *StackTable< Element, ConflictFunction >::lookup( std::string id ) const { 59 59 typename TableType::const_iterator it = table.find( id ); 60 60 if ( it == table.end() ) { … … 65 65 return 0; 66 66 } // if 67 }67 } 68 68 69 template< typename Element, typename ConflictFunction >70 void StackTable< Element, ConflictFunction >::dump( std::ostream &os ) const {69 template< typename Element, typename ConflictFunction > 70 void StackTable< Element, ConflictFunction >::dump( std::ostream &os ) const { 71 71 for ( typename TableType::const_iterator it = table.begin(); it != table.end(); ++it ) { 72 72 const std::stack< Entry >& entry = it->second; … … 75 75 } // if 76 76 } // for 77 }77 } 78 78 } // namespace SymTab 79 79
Note:
See TracChangeset
for help on using the changeset viewer.