Ignore:
Timestamp:
Jun 8, 2023, 3:19:43 PM (3 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT
Parents:
044ae62
Message:

Finish Adt POC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Validate/ReplaceTypedef.cpp

    r044ae62 rfa2c005  
    6060        ast::StructDecl const * previsit( ast::StructDecl const * );
    6161        ast::UnionDecl const * previsit( ast::UnionDecl const * );
     62        ast::AdtDecl const * previsit( ast::AdtDecl const * );
    6263        void previsit( ast::EnumDecl const * );
    6364        void previsit( ast::TraitDecl const * );
     
    9091}
    9192
     93// Here, 5/30
    9294ast::Type const * ReplaceTypedefCore::postvisit(
    9395                ast::TypeInstType const * type ) {
    9496        // Instances of typedef types will come here. If it is an instance
    9597        // of a typedef type, link the instance to its actual type.
    96         TypedefMap::const_iterator def = typedefNames.find( type->name );
     98        TypedefMap::const_iterator def = typedefNames.find( type->name ); // because of this
    9799        if ( def != typedefNames.end() ) {
    98100                ast::Type * ret = ast::deepCopy( def->second.first->base );
     
    260262}
    261263
     264ast::AdtDecl const * ReplaceTypedefCore::previsit( ast::AdtDecl const * decl ) {
     265        visit_children = false;
     266        addImplicitTypedef( decl );
     267        return handleAggregate( decl );
     268}
     269
    262270ast::UnionDecl const * ReplaceTypedefCore::previsit( ast::UnionDecl const * decl ) {
    263271        visit_children = false;
     
    287295        } else if ( auto enumDecl = dynamic_cast<const ast::EnumDecl *>( aggrDecl ) ) {
    288296                type = new ast::EnumInstType( enumDecl->name );
     297        } else if ( auto adtDecl = dynamic_cast<const ast::AdtDecl *>( aggrDecl )) {
     298                type = new ast::AdtInstType( adtDecl->name );
    289299        }
    290300        assert( type );
Note: See TracChangeset for help on using the changeset viewer.