Changes in src/AST/TypeEnvironment.hpp [3e5dd913:361bf01]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/TypeEnvironment.hpp
r3e5dd913 r361bf01 55 55 /// recorded. More investigation is needed. 56 56 struct AssertCompare { 57 bool operator()( const VariableExpr * d1, const VariableExpr* d2 ) const {58 int cmp = d1-> var->name.compare( d2->var->name );59 return cmp < 0 || ( cmp == 0 && d1-> result < d2->result);57 bool operator()( const DeclWithType * d1, const DeclWithType * d2 ) const { 58 int cmp = d1->name.compare( d2->name ); 59 return cmp < 0 || ( cmp == 0 && d1->get_type() < d2->get_type() ); 60 60 } 61 61 }; … … 70 70 71 71 /// Set of assertions pending satisfaction 72 using AssertionSet = std::map< const VariableExpr *, AssertionSetValue, AssertCompare >;72 using AssertionSet = std::map< readonly<DeclWithType>, AssertionSetValue, AssertCompare >; 73 73 74 74 /// Set of open variables 75 using OpenVarSet = std::unordered_map< TypeInstType::TypeEnvKey, TypeDecl::Data >;75 using OpenVarSet = std::unordered_map< std::string, TypeDecl::Data >; 76 76 77 77 /// Merges one set of open vars into another … … 89 89 /// they bind to. 90 90 struct EqvClass { 91 std:: unordered_set< TypeInstType::TypeEnvKey> vars;91 std::set< std::string > vars; 92 92 ptr<Type> bound; 93 93 bool allowWidening; … … 101 101 102 102 /// Singleton class constructor from TypeDecl 103 EqvClass( const Type InstType * inst)104 : vars{ *inst }, bound(), allowWidening( true ), data( inst->base) {}103 EqvClass( const TypeDecl * decl ) 104 : vars{ decl->name }, bound(), allowWidening( true ), data( decl ) {} 105 105 106 106 /// Singleton class constructor from substitution 107 EqvClass( const TypeInstType::TypeEnvKey& v, const Type * b )107 EqvClass( const std::string & v, const Type * b ) 108 108 : vars{ v }, bound( b ), allowWidening( false ), data( TypeDecl::Dtype, false ) {} 109 109 110 110 /// Single-var constructor (strips qualifiers from bound type) 111 EqvClass( const TypeInstType::TypeEnvKey& v, const Type * b, bool w, const TypeDecl::Data & d )111 EqvClass( const std::string & v, const Type * b, bool w, const TypeDecl::Data & d ) 112 112 : vars{ v }, bound( b ), allowWidening( w ), data( d ) { 113 113 reset_qualifiers( bound ); … … 115 115 116 116 /// Double-var constructor 117 EqvClass( const TypeInstType::TypeEnvKey & v, const TypeInstType::TypeEnvKey& u, bool w, const TypeDecl::Data & d )117 EqvClass( const std::string & v, const std::string & u, bool w, const TypeDecl::Data & d ) 118 118 : vars{ v, u }, bound(), allowWidening( w ), data( d ) {} 119 119 … … 131 131 public: 132 132 /// Finds the equivalence class containing a variable; nullptr for none such 133 const EqvClass * lookup( const TypeInstType::TypeEnvKey& var ) const;133 const EqvClass * lookup( const std::string & var ) const; 134 134 135 135 /// Add a new equivalence class for each type variable … … 207 207 208 208 /// Private lookup API; returns array index of string, or env.size() for not found 209 ClassList::iterator internal_lookup( const TypeInstType::TypeEnvKey& );209 ClassList::iterator internal_lookup( const std::string & ); 210 210 }; 211 211
Note: See TracChangeset
for help on using the changeset viewer.