Changeset bccd70a for src/AST/TypeSubstitution.cpp
- Timestamp:
- May 25, 2023, 1:01:00 PM (12 months ago)
- Branches:
- ast-experimental, master
- Children:
- a5294af
- Parents:
- 382467f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/TypeSubstitution.cpp
r382467f rbccd70a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 3 13:26:00 2017 13 // Update Count : 5 14 // 12 // Last Modified On : Thr May 25 11:24:00 2023 13 // Update Count : 6 14 // 15 16 #include "TypeSubstitution.hpp" 15 17 16 18 #include "Type.hpp" // for TypeInstType, Type, StructInstType, UnionInstType 17 #include " TypeSubstitution.hpp"19 #include "Pass.hpp" // for Pass, PureVisitor, WithGuards, WithVisitorRef 18 20 19 21 namespace ast { 20 21 22 // size_t TypeSubstitution::Substituter::traceId = Stats::Heap::new_stacktrace_id("TypeSubstitution");23 22 24 23 TypeSubstitution::TypeSubstitution() { … … 119 118 } 120 119 120 // definitition must happen after PassVisitor is included so that WithGuards can be used 121 struct TypeSubstitution::Substituter : public WithGuards, public WithVisitorRef<Substituter>, public PureVisitor { 122 //static size_t traceId; 123 124 Substituter( const TypeSubstitution & sub, bool freeOnly ) : sub( sub ), freeOnly( freeOnly ) {} 125 126 const Type * postvisit( const TypeInstType * aggregateUseType ); 127 128 /// Records type variable bindings from forall-statements 129 void previsit( const FunctionType * type ); 130 /// Records type variable bindings from forall-statements and instantiations of generic types 131 // void handleAggregateType( const BaseInstType * type ); 132 133 // void previsit( const StructInstType * aggregateUseType ); 134 // void previsit( const UnionInstType * aggregateUseType ); 135 136 const TypeSubstitution & sub; 137 int subCount = 0; 138 bool freeOnly; 139 typedef std::unordered_set< TypeEnvKey > BoundVarsType; 140 BoundVarsType boundVars; 141 }; 142 143 // size_t TypeSubstitution::Substituter::traceId = Stats::Heap::new_stacktrace_id("TypeSubstitution"); 144 121 145 void TypeSubstitution::normalize() { 122 146 Pass<Substituter> sub( *this, true ); … … 128 152 } 129 153 } while ( sub.core.subCount ); 154 } 155 156 TypeSubstitution::ApplyResult<Node> TypeSubstitution::applyBase( 157 const Node * input, bool isFree ) const { 158 assert( input ); 159 Pass<Substituter> sub( *this, isFree ); 160 const Node * output = input->accept( sub ); 161 return { output, sub.core.subCount }; 130 162 } 131 163
Note: See TracChangeset
for help on using the changeset viewer.