Changeset 28f3a19 for src/ResolvExpr/TypeEnvironment.h
- Timestamp:
- Jun 27, 2018, 3:28:41 PM (6 years ago)
- Branches:
- new-env, with_gc
- Children:
- b21c77a
- Parents:
- 0182bfa (diff), 63238a4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/TypeEnvironment.h
r0182bfa r28f3a19 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 12:24:58 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Jul 22 09:35:45 201713 // Update Count : 311 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Mon Jun 18 11:58:00 2018 13 // Update Count : 4 14 14 // 15 15 … … 21 21 #include <set> // for set 22 22 #include <string> // for string 23 #include <utility> // for move, swap 24 25 #include "WidenMode.h" // for WidenMode 23 26 24 27 #include "SynTree/Declaration.h" // for TypeDecl::Data, DeclarationWit... … … 77 80 78 81 void initialize( const EqvClass &src, EqvClass &dest ); 82 void initialize( const EqvClass &src, EqvClass &dest, const Type *ty ); 79 83 EqvClass(); 80 84 EqvClass( const EqvClass &other ); 85 EqvClass( const EqvClass &other, const Type *ty ); 86 EqvClass( EqvClass &&other ); 81 87 EqvClass &operator=( const EqvClass &other ); 88 EqvClass &operator=( EqvClass &&other ); 82 89 void print( std::ostream &os, Indenter indent = {} ) const; 90 91 /// Takes ownership of `ty`, freeing old `type` 92 void set_type(Type* ty); 83 93 }; 84 94 … … 86 96 public: 87 97 const EqvClass* lookup( const std::string &var ) const; 88 void add( const EqvClass &eqvClass );98 private: 89 99 void add( EqvClass &&eqvClass ); 100 public: 90 101 void add( const Type::ForallList &tyDecls ); 91 102 void add( const TypeSubstitution & sub ); … … 95 106 bool isEmpty() const { return env.empty(); } 96 107 void print( std::ostream &os, Indenter indent = {} ) const; 97 void combine( const TypeEnvironment &second, Type *(*combineFunc)( Type*, Type* ) );108 // void combine( const TypeEnvironment &second, Type *(*combineFunc)( Type*, Type* ) ); 98 109 void simpleCombine( const TypeEnvironment &second ); 99 110 void extractOpenVars( OpenVarSet &openVars ) const; … … 104 115 void addActual( const TypeEnvironment& actualEnv, OpenVarSet& openVars ); 105 116 106 typedef std::list< EqvClass >::iterator iterator; 107 iterator begin() { return env.begin(); } 108 iterator end() { return env.end(); } 109 typedef std::list< EqvClass >::const_iterator const_iterator; 110 const_iterator begin() const { return env.begin(); } 111 const_iterator end() const { return env.end(); } 117 /// Binds the type class represented by `typeInst` to the type `bindTo`; will add 118 /// the class if needed. Returns false on failure. 119 bool bindVar( TypeInstType *typeInst, Type *bindTo, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ); 120 121 /// Binds the type classes represented by `var1` and `var2` together; will add 122 /// one or both classes if needed. Returns false on failure. 123 bool bindVarToVar( TypeInstType *var1, TypeInstType *var2, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ); 124 125 /// Disallows widening for all bindings in the environment 126 void forbidWidening(); 127 128 using iterator = std::list< EqvClass >::const_iterator; 129 iterator begin() const { return env.begin(); } 130 iterator end() const { return env.end(); } 131 112 132 private: 113 133 std::list< EqvClass > env; 134 114 135 std::list< EqvClass >::iterator internal_lookup( const std::string &var ); 115 136 };
Note: See TracChangeset
for help on using the changeset viewer.