Changeset f23de79d for src/AST/TypeSubstitution.hpp
- Timestamp:
- May 22, 2019, 5:34:17 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 0b8bf27
- Parents:
- 5902625 (diff), 722c4831 (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/AST/TypeSubstitution.hpp
r5902625 rf23de79d 25 25 #include "Fwd.hpp" // for UniqueId 26 26 #include "ParseNode.hpp" 27 #include "Type.hpp" // for ptr<Type>27 #include "Type.hpp" 28 28 #include "Common/SemanticError.h" // for SemanticError 29 29 #include "Visitor.hpp" 30 30 #include "Decl.hpp" 31 31 #include "Expr.hpp" 32 #include "Node.hpp" 32 33 33 34 namespace ast { … … 43 44 TypeSubstitution &operator=( const TypeSubstitution &other ); 44 45 45 template< typename SynTreeClass > int apply( SynTreeClass *&input ) const; 46 template< typename SynTreeClass > int applyFree( SynTreeClass *&input ) const; 46 template< typename SynTreeClass > int apply( const SynTreeClass *& input ) const; 47 template< typename SynTreeClass > int applyFree( const SynTreeClass *& input ) const; 48 49 template< typename node_t, enum Node::ref_type ref_t > 50 int apply( ptr_base< node_t, ref_t > & input ) const { 51 const node_t * p = input.get(); 52 int ret = apply(p); 53 input = p; 54 return ret; 55 } 56 57 template< typename node_t, enum Node::ref_type ref_t > 58 int applyFree( ptr_base< node_t, ref_t > & input ) const { 59 const node_t * p = input.get(); 60 int ret = applyFree(p); 61 input = p; 62 return ret; 63 } 47 64 48 65 void add( std::string formalType, const Type *actualType ); … … 162 179 163 180 template< typename SynTreeClass > 164 int TypeSubstitution::apply( SynTreeClass *&input ) const {181 int TypeSubstitution::apply( const SynTreeClass *& input ) const { 165 182 assert( input ); 166 183 Pass<Substituter> sub( *this, false ); 167 input = dynamic_cast< SynTreeClass * >( input->acceptMutator( sub ) ); 168 assert( input ); 184 input = strict_dynamic_cast< const SynTreeClass * >( input->accept( sub ) ); 169 185 /// std::cerr << "substitution result is: "; 170 186 /// newType->print( std::cerr ); … … 174 190 175 191 template< typename SynTreeClass > 176 int TypeSubstitution::applyFree( SynTreeClass *&input ) const {192 int TypeSubstitution::applyFree( const SynTreeClass *& input ) const { 177 193 assert( input ); 178 194 Pass<Substituter> sub( *this, true ); 179 input = dynamic_cast< SynTreeClass * >( input->acceptMutator( sub ) ); 180 assert( input ); 195 input = strict_dynamic_cast< const SynTreeClass * >( input->accept( sub ) ); 181 196 /// std::cerr << "substitution result is: "; 182 197 /// newType->print( std::cerr );
Note: See TracChangeset
for help on using the changeset viewer.