Changeset 982f95d for src/ResolvExpr/Occurs.cc
- Timestamp:
- Jun 15, 2018, 5:09:29 PM (6 years ago)
- Branches:
- new-env
- Children:
- 97397a26
- Parents:
- 1d7b0a8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Occurs.cc
r1d7b0a8 r982f95d 14 14 // 15 15 16 #include <set> // for set, _Rb_tree_const_iterator17 16 #include <string> // for string 17 #include <unordered_set> // for unordered_set 18 18 19 19 #include "Common/PassVisitor.h" 20 20 #include "SynTree/Type.h" // for TypeInstType, Type 21 #include "TypeEnvironment.h" // for EqvClass, TypeEnvironment21 #include "TypeEnvironment.h" // for ClassRef, TypeEnvironment 22 22 23 23 namespace ResolvExpr { … … 27 27 28 28 bool result; 29 std::set< std::string > eqvVars; 29 using VarSet = std::unordered_set< std::string >; 30 VarSet eqvVars; 30 31 const TypeEnvironment &tenv; 31 32 }; … … 38 39 39 40 Occurs::Occurs( std::string varName, const TypeEnvironment & env ) : result( false ), tenv( env ) { 40 if ( const EqvClass *eqvClass = tenv.lookup( varName ) ) {41 eqvVars = eqvClass ->vars;41 if ( ClassRef eqvClass = tenv.lookup( varName ) ) { 42 eqvVars = eqvClass.get_vars<VarSet>(); 42 43 } else { 43 44 eqvVars.insert( varName ); … … 51 52 if ( eqvVars.find( typeInst->get_name() ) != eqvVars.end() ) { 52 53 result = true; 53 } else if ( const EqvClass *eqvClass = tenv.lookup( typeInst->get_name() ) ) {54 if ( eqvClass->type ) {54 } else if ( ClassRef eqvClass = tenv.lookup( typeInst->get_name() ) ) { 55 if ( Type* boundTy = eqvClass.get_bound().type ) { 55 56 /// std::cerr << typeInst->get_name() << " is bound to"; 56 /// eqvClass.type->print( std::cerr );57 /// boundTy->print( std::cerr ); 57 58 /// std::cerr << std::endl; 58 eqvClass->type->accept( *visitor );59 boundTy->accept( *visitor ); 59 60 } // if 60 61 } // if
Note: See TracChangeset
for help on using the changeset viewer.