Changeset 66b6f66


Ignore:
Timestamp:
Apr 17, 2023, 11:00:38 AM (13 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
81bd7e3
Parents:
6349929
Message:

Cleaned up some indentation in DeclarationNode?.h.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.h

    r6349929 r66b6f66  
    179179// This generic buildList is here along side its overloads.
    180180template<typename AstType, typename NodeType,
    181     template<typename, typename...> class Container, typename... Args>
     181                template<typename, typename...> class Container, typename... Args>
    182182void buildList( NodeType * firstNode,
    183         Container<ast::ptr<AstType>, Args...> & output ) {
    184     SemanticErrorException errors;
    185     std::back_insert_iterator<Container<ast::ptr<AstType>, Args...>> out( output );
    186     NodeType * cur = firstNode;
    187 
    188     while ( cur ) {
    189         try {
    190             if ( auto result = dynamic_cast<AstType *>( maybeBuild( cur ) ) ) {
    191                 *out++ = result;
    192             } else {
    193                 assertf(false, __PRETTY_FUNCTION__ );
    194                 SemanticError( cur->location, "type specifier declaration in forall clause is currently unimplemented." );
    195             } // if
    196         } catch( SemanticErrorException & e ) {
    197             errors.append( e );
    198         } // try
    199         ParseNode * temp = cur->get_next();
    200         // Should not return nullptr, then it is non-homogeneous:
    201         cur = dynamic_cast<NodeType *>( temp );
    202         if ( !cur && temp ) {
    203             SemanticError( temp->location, "internal error, non-homogeneous nodes founds in buildList processing." );
    204         } // if
    205     } // while
    206     if ( ! errors.isEmpty() ) {
    207         throw errors;
    208     } // if
     183                Container<ast::ptr<AstType>, Args...> & output ) {
     184        SemanticErrorException errors;
     185        std::back_insert_iterator<Container<ast::ptr<AstType>, Args...>> out( output );
     186        NodeType * cur = firstNode;
     187
     188        while ( cur ) {
     189                try {
     190                        if ( auto result = dynamic_cast<AstType *>( maybeBuild( cur ) ) ) {
     191                                *out++ = result;
     192                        } else {
     193                                assertf(false, __PRETTY_FUNCTION__ );
     194                                SemanticError( cur->location, "type specifier declaration in forall clause is currently unimplemented." );
     195                        } // if
     196                } catch( SemanticErrorException & e ) {
     197                        errors.append( e );
     198                } // try
     199                ParseNode * temp = cur->get_next();
     200                // Should not return nullptr, then it is non-homogeneous:
     201                cur = dynamic_cast<NodeType *>( temp );
     202                if ( !cur && temp ) {
     203                        SemanticError( temp->location, "internal error, non-homogeneous nodes founds in buildList processing." );
     204                } // if
     205        } // while
     206        if ( ! errors.isEmpty() ) {
     207                throw errors;
     208        } // if
    209209}
    210210
     
    214214
    215215template<typename AstType, typename NodeType,
    216 template<typename, typename...> class Container, typename... Args>
     216                template<typename, typename...> class Container, typename... Args>
    217217void buildMoveList( NodeType * firstNode,
    218218                Container<ast::ptr<AstType>, Args...> & output ) {
Note: See TracChangeset for help on using the changeset viewer.