Ignore:
Timestamp:
Jun 7, 2019, 4:14:48 PM (5 years ago)
Author:
Aaron Moss <a3moss@…>
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:
05d55ff
Parents:
5684736
git-author:
Aaron Moss <a3moss@…> (06/07/19 16:14:40)
git-committer:
Aaron Moss <a3moss@…> (06/07/19 16:14:48)
Message:

More resolver porting; mostly CurrentObject?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/GenericSubstitution.cpp

    r5684736 r60aaa51d  
    3131                TypeSubstitution sub;
    3232
    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;
    3636                }
    3737
     
    4040                }
    4141
    42                 void previsit( const ReferenceToType * ty ) {
     42        private:
     43                // make substitution for generic type
     44                void makeSub( const ReferenceToType * ty ) {
    4345                        visit_children = false;
    44                         // build substitution from base parameters
    4546                        const AggregateDecl * aggr = ty->aggr();
    4647                        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 );
    4757                }
    4858        };
    4959}
    5060
    51 TypeSubstitution genericSubsitution( const Type * ty ) {
     61TypeSubstitution genericSubstitution( const Type * ty ) {
    5262        Pass<GenericSubstitutionBuilder> builder;
    5363        maybe_accept( ty, builder );
Note: See TracChangeset for help on using the changeset viewer.