Ignore:
Timestamp:
Feb 27, 2024, 12:28:58 PM (4 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
924534e
Parents:
4c0b674
Message:

Factored out the ParseNode?'s next field into a new child type. This is only type safe when used in the given one level curiously reoccurring template pattern, as it is now. This allowed most of the intermedate helpers to be removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ExpressionNode.h

    r4c0b674 rdc3fbe5  
    1818#include "ParseNode.h"
    1919
    20 class InitializerNode;
     20struct InitializerNode;
    2121
    22 class ExpressionNode final : public ParseNode {
    23 public:
     22struct ExpressionNode final : public ParseList<ExpressionNode> {
    2423        ExpressionNode( ast::Expr * expr = nullptr ) : expr( expr ) {}
    2524        virtual ~ExpressionNode() {}
    2625        virtual ExpressionNode * clone() const override {
    2726                if ( nullptr == expr ) return nullptr;
    28                 return static_cast<ExpressionNode*>(
    29                         (new ExpressionNode( ast::shallowCopy( expr.get() ) ))->set_next( maybeCopy( get_next() ) ));
     27                ExpressionNode * node = new ExpressionNode( ast::shallowCopy( expr.get() ) );
     28                node->set_next( maybeCopy( get_next() ) );
     29                return node;
    3030        }
    3131
Note: See TracChangeset for help on using the changeset viewer.