Changeset e7f8119 for src/AST/GenericSubstitution.cpp
- Timestamp:
- Jun 10, 2019, 10:52:03 AM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 6355ba7
- Parents:
- 9856ca9 (diff), 61c7239 (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/GenericSubstitution.cpp
r9856ca9 re7f8119 31 31 TypeSubstitution sub; 32 32 33 void previsit( const Type * ty) {34 assertf( false, "Attempted generic substitution for non-aggregate type: %s",35 toString( ty ).c_str() );33 void previsit( const Type * ) { 34 // allow empty substitution for non-generic type 35 visit_children = false; 36 36 } 37 37 … … 40 40 } 41 41 42 void previsit( const ReferenceToType * ty ) { 42 private: 43 // make substitution for generic type 44 void makeSub( const ReferenceToType * ty ) { 43 45 visit_children = false; 44 // build substitution from base parameters45 46 const AggregateDecl * aggr = ty->aggr(); 46 47 sub = TypeSubstitution{ aggr->params.begin(), aggr->params.end(), ty->params.begin() }; 48 } 49 50 public: 51 void previsit( const StructInstType * ty ) { 52 makeSub( ty ); 53 } 54 55 void previsit( const UnionInstType * ty ) { 56 makeSub( ty ); 47 57 } 48 58 }; 49 59 } 50 60 51 TypeSubstitution genericSubs itution( const Type * ty ) {61 TypeSubstitution genericSubstitution( const Type * ty ) { 52 62 Pass<GenericSubstitutionBuilder> builder; 53 63 maybe_accept( ty, builder );
Note: See TracChangeset
for help on using the changeset viewer.