- File:
-
- 1 edited
-
src/AST/GenericSubstitution.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/GenericSubstitution.cpp
r60aaa51d r335f2d8 31 31 TypeSubstitution sub; 32 32 33 void previsit( const Type * ) {34 // allow empty substitution for non-generic type35 visit_children = false;33 void previsit( const Type * ty ) { 34 assertf( false, "Attempted generic substitution for non-aggregate type: %s", 35 toString( ty ).c_str() ); 36 36 } 37 37 … … 40 40 } 41 41 42 private: 43 // make substitution for generic type 44 void makeSub( const ReferenceToType * ty ) { 42 void previsit( const ReferenceToType * ty ) { 45 43 visit_children = false; 44 // build substitution from base parameters 46 45 const AggregateDecl * aggr = ty->aggr(); 47 46 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 );57 47 } 58 48 }; 59 49 } 60 50 61 TypeSubstitution genericSubs titution( const Type * ty ) {51 TypeSubstitution genericSubsitution( const Type * ty ) { 62 52 Pass<GenericSubstitutionBuilder> builder; 63 53 maybe_accept( ty, builder );
Note:
See TracChangeset
for help on using the changeset viewer.