Changeset a9ae5ca


Ignore:
Timestamp:
Aug 3, 2024, 1:10:11 AM (26 hours ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
4e107bf
Parents:
c141c09
Message:

remove unused addInitType

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/TranslateEnumRange.cpp

    rc141c09 ra9ae5ca  
    55
    66namespace ControlStruct {
    7 
    8 struct addInitType {
    9     const ast::Stmt * postvisit( const ast::ForStmt * stmt );
    10 };
    117
    128struct addInit {
     
    1713    const ast::Stmt * postvisit( const ast::ForStmt * stmt );
    1814};
    19 
    20 const ast::Stmt* addInitType::postvisit( const ast::ForStmt * stmt ) {
    21     if ( stmt->range_over ) {
    22         auto typeExpr = stmt->range_over.strict_as<ast::TypeExpr>();
    23         auto type = typeExpr->type;
    24 
    25         auto objInit = stmt->inits.front();
    26         assert( stmt->inits.size() == 1 );
    27 
    28         if (auto declStmt = objInit.as<ast::DeclStmt>()) {
    29             auto decl = declStmt->decl;
    30             if ( auto objDecl = decl.as<ast::ObjectDecl>()) {
    31                 if ( !objDecl->type && type ) {
    32                     auto objDeclWithType = ast::mutate_field( objDecl, &ast::ObjectDecl::type, type );
    33                     auto declWithType = ast::mutate_field( declStmt, &ast::DeclStmt::decl, objDeclWithType );
    34                     stmt = ast::mutate_field_index( stmt, &ast::ForStmt::inits, 0, declWithType );
    35                 }
    36             }
    37         }
    38     }
    39     return stmt;
    40 }
    4115
    4216const ast::Stmt* addInit::postvisit( const ast::ForStmt * stmt ) {
     
    8761    mut = ast::mutate_field(stmt, &ast::ForStmt::inc, assig );
    8862    return mut;
    89 }
     63} 
    9064
    9165void translateEnumRange( ast::TranslationUnit & translationUnit ) {
Note: See TracChangeset for help on using the changeset viewer.