Ignore:
Timestamp:
Apr 11, 2023, 12:48:03 PM (14 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
5541a44e
Parents:
9921573
Message:

Clean-up in parser. ClauseNode? rework, plus internal adjustments to reduce extra code and unchecked casts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.h

    r9921573 r6611177  
    180180template<typename AstType, typename NodeType,
    181181    template<typename, typename...> class Container, typename... Args>
    182 void buildList( const NodeType * firstNode,
     182void buildList( NodeType * firstNode,
    183183        Container<ast::ptr<AstType>, Args...> & output ) {
    184184    SemanticErrorException errors;
    185185    std::back_insert_iterator<Container<ast::ptr<AstType>, Args...>> out( output );
    186     const NodeType * cur = firstNode;
     186    NodeType * cur = firstNode;
    187187
    188188    while ( cur ) {
     
    197197            errors.append( e );
    198198        } // try
    199         const ParseNode * temp = cur->get_next();
     199        ParseNode * temp = cur->get_next();
    200200        // Should not return nullptr, then it is non-homogeneous:
    201         cur = dynamic_cast<const NodeType *>( temp );
     201        cur = dynamic_cast<NodeType *>( temp );
    202202        if ( !cur && temp ) {
    203203            SemanticError( temp->location, "internal error, non-homogeneous nodes founds in buildList processing." );
     
    209209}
    210210
    211 void buildList( const DeclarationNode * firstNode, std::vector<ast::ptr<ast::Decl>> & outputList );
    212 void buildList( const DeclarationNode * firstNode, std::vector<ast::ptr<ast::DeclWithType>> & outputList );
     211void buildList( DeclarationNode * firstNode, std::vector<ast::ptr<ast::Decl>> & outputList );
     212void buildList( DeclarationNode * firstNode, std::vector<ast::ptr<ast::DeclWithType>> & outputList );
    213213void buildTypeList( const DeclarationNode * firstNode, std::vector<ast::ptr<ast::Type>> & outputList );
    214214
    215215template<typename AstType, typename NodeType,
    216216template<typename, typename...> class Container, typename... Args>
    217 void buildMoveList( const NodeType * firstNode,
    218 Container<ast::ptr<AstType>, Args...> & output ) {
    219 buildList<AstType, NodeType, Container, Args...>( firstNode, output );
    220 delete firstNode;
     217void buildMoveList( NodeType * firstNode,
     218                Container<ast::ptr<AstType>, Args...> & output ) {
     219        buildList<AstType, NodeType, Container, Args...>( firstNode, output );
     220        delete firstNode;
    221221}
Note: See TracChangeset for help on using the changeset viewer.