Changeset 6d6cf5a for src/ResolvExpr/TypeEnvironment.h
- Timestamp:
- Jun 27, 2018, 6:37:55 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 64188cc
- Parents:
- b199e54 (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
rb199e54 r6d6cf5a 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 EqvClass( const EqvClass &other ); 78 81 EqvClass( const EqvClass &other, const Type *ty ); 82 EqvClass( EqvClass &&other ); 79 83 EqvClass &operator=( const EqvClass &other ); 84 EqvClass &operator=( EqvClass &&other ); 80 85 ~EqvClass(); 81 86 void print( std::ostream &os, Indenter indent = {} ) const; 87 88 /// Takes ownership of `ty`, freeing old `type` 89 void set_type(Type* ty); 82 90 }; 83 91 … … 85 93 public: 86 94 const EqvClass* lookup( const std::string &var ) const; 87 void add( const EqvClass &eqvClass );95 private: 88 96 void add( EqvClass &&eqvClass ); 97 public: 89 98 void add( const Type::ForallList &tyDecls ); 90 99 void add( const TypeSubstitution & sub ); … … 94 103 bool isEmpty() const { return env.empty(); } 95 104 void print( std::ostream &os, Indenter indent = {} ) const; 96 void combine( const TypeEnvironment &second, Type *(*combineFunc)( Type*, Type* ) );105 // void combine( const TypeEnvironment &second, Type *(*combineFunc)( Type*, Type* ) ); 97 106 void simpleCombine( const TypeEnvironment &second ); 98 107 void extractOpenVars( OpenVarSet &openVars ) const; … … 103 112 void addActual( const TypeEnvironment& actualEnv, OpenVarSet& openVars ); 104 113 105 typedef std::list< EqvClass >::iterator iterator; 106 iterator begin() { return env.begin(); } 107 iterator end() { return env.end(); } 108 typedef std::list< EqvClass >::const_iterator const_iterator; 109 const_iterator begin() const { return env.begin(); } 110 const_iterator end() const { return env.end(); } 114 /// Binds the type class represented by `typeInst` to the type `bindTo`; will add 115 /// the class if needed. Returns false on failure. 116 bool bindVar( TypeInstType *typeInst, Type *bindTo, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ); 117 118 /// Binds the type classes represented by `var1` and `var2` together; will add 119 /// one or both classes if needed. Returns false on failure. 120 bool bindVarToVar( TypeInstType *var1, TypeInstType *var2, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ); 121 122 /// Disallows widening for all bindings in the environment 123 void forbidWidening(); 124 125 using iterator = std::list< EqvClass >::const_iterator; 126 iterator begin() const { return env.begin(); } 127 iterator end() const { return env.end(); } 128 111 129 private: 112 130 std::list< EqvClass > env; 131 113 132 std::list< EqvClass >::iterator internal_lookup( const std::string &var ); 114 133 };
Note: See TracChangeset
for help on using the changeset viewer.