Ignore:
Timestamp:
Mar 5, 2024, 9:55:04 AM (8 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
af60383
Parents:
9262fe9
Message:

Removed casts around get_next (also replaced with direct field access) that are no longer needed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/StatementNode.cc

    r9262fe9 r44adf1b  
    5454                StatementNode * nextStmt = new StatementNode(
    5555                        new ast::DeclStmt( decl->location, maybeBuild( decl ) ) );
    56                 set_next( nextStmt );
    57                 if ( decl->get_next() ) {
    58                         get_next()->set_next( new StatementNode( dynamic_cast< DeclarationNode * >(decl->get_next()) ) );
    59                         decl->set_next( 0 );
     56                next = nextStmt;
     57                if ( decl->next ) {
     58                        next->next = new StatementNode( decl->next );
     59                        decl->next = nullptr;
    6060                } // if
    6161        } else {
    62                 if ( decl->get_next() ) {
    63                         set_next( new StatementNode( dynamic_cast< DeclarationNode * >( decl->get_next() ) ) );
    64                         decl->set_next( 0 );
     62                if ( decl->next ) {
     63                        next = new StatementNode( decl->next );
     64                        decl->next = nullptr;
    6565                } // if
    6666                agg = decl;
     
    8787        ClauseNode * prev = this;
    8888        // find end of list and maintain previous pointer
    89         for ( ClauseNode * curr = prev; curr != nullptr; curr = (ClauseNode *)curr->get_next() ) {
    90                 ClauseNode * node = strict_dynamic_cast< ClauseNode * >(curr);
     89        for ( ClauseNode * curr = prev; curr != nullptr; curr = curr->next ) {
     90                ClauseNode * node = curr;
    9191                assert( dynamic_cast<ast::CaseClause *>( node->clause.get() ) );
    9292                prev = curr;
    9393        } // for
    94         ClauseNode * node = dynamic_cast< ClauseNode * >(prev);
     94        ClauseNode * node = prev;
    9595        // convert from StatementNode list to Statement list
    9696        std::vector<ast::ptr<ast::Stmt>> stmts;
     
    332332        clause->when_cond = notZeroExpr( maybeMoveBuild( when ) );
    333333
    334         ExpressionNode * next = dynamic_cast<ExpressionNode *>( targetExpr->get_next() );
    335         targetExpr->set_next( nullptr );
     334        ExpressionNode * next = targetExpr->next;
     335        targetExpr->next = nullptr;
    336336        buildMoveList( next, clause->target_args );
    337337
Note: See TracChangeset for help on using the changeset viewer.