Changeset 93c10de for src/AST/TypeEnvironment.cpp
- Timestamp:
- Nov 24, 2022, 11:01:37 AM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 82a90d4
- Parents:
- 78de1e5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/TypeEnvironment.cpp
r78de1e5 r93c10de 82 82 } 83 83 84 const EqvClass * TypeEnvironment::lookup( const Type InstType::TypeEnvKey & var ) const {84 const EqvClass * TypeEnvironment::lookup( const TypeEnvKey & var ) const { 85 85 for ( ClassList::const_iterator i = env.begin(); i != env.end(); ++i ) { 86 86 if ( i->vars.find( var ) != i->vars.end() ) return &*i; … … 122 122 void TypeEnvironment::writeToSubstitution( TypeSubstitution & sub ) const { 123 123 for ( const auto & clz : env ) { 124 Type InstType::TypeEnvKey clzRep;124 TypeEnvKey clzRep; 125 125 bool first = true; 126 126 for ( const auto & var : clz.vars ) { … … 146 146 struct Occurs : public ast::WithVisitorRef<Occurs> { 147 147 bool result; 148 std::unordered_set< Type InstType::TypeEnvKey > vars;148 std::unordered_set< TypeEnvKey > vars; 149 149 const TypeEnvironment & tenv; 150 150 151 Occurs( const Type InstType::TypeEnvKey & var, const TypeEnvironment & env )151 Occurs( const TypeEnvKey & var, const TypeEnvironment & env ) 152 152 : result( false ), vars(), tenv( env ) { 153 153 if ( const EqvClass * clz = tenv.lookup( var ) ) { … … 170 170 171 171 /// true if `var` occurs in `ty` under `env` 172 bool occurs( const Type * ty, const Type InstType::TypeEnvKey & var, const TypeEnvironment & env ) {172 bool occurs( const Type * ty, const TypeEnvKey & var, const TypeEnvironment & env ) { 173 173 Pass<Occurs> occur{ var, env }; 174 174 maybe_accept( ty, occur ); … … 258 258 namespace { 259 259 /// true if the given type can be bound to the given type variable 260 bool tyVarCompatible( const TypeD ecl::Data & data, const Type * type ) {260 bool tyVarCompatible( const TypeData & data, const Type * type ) { 261 261 switch ( data.kind ) { 262 262 case TypeDecl::Dtype: … … 279 279 280 280 bool TypeEnvironment::bindVar( 281 const TypeInstType * typeInst, const Type * bindTo, const TypeD ecl::Data & data,281 const TypeInstType * typeInst, const Type * bindTo, const TypeData & data, 282 282 AssertionSet & need, AssertionSet & have, const OpenVarSet & open, WidenMode widen, 283 283 const SymbolTable & symtab … … 319 319 320 320 bool TypeEnvironment::bindVarToVar( 321 const TypeInstType * var1, const TypeInstType * var2, TypeD ecl::Data && data,321 const TypeInstType * var1, const TypeInstType * var2, TypeData && data, 322 322 AssertionSet & need, AssertionSet & have, const OpenVarSet & open, 323 323 WidenMode widen, const SymbolTable & symtab … … 457 457 } 458 458 459 TypeEnvironment::ClassList::iterator TypeEnvironment::internal_lookup( const Type InstType::TypeEnvKey & var ) {459 TypeEnvironment::ClassList::iterator TypeEnvironment::internal_lookup( const TypeEnvKey & var ) { 460 460 for ( ClassList::iterator i = env.begin(); i != env.end(); ++i ) { 461 461 if ( i->vars.count( var ) ) return i;
Note: See TracChangeset
for help on using the changeset viewer.