Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.h

    raf60383 r4eb3a7c5  
    1919
    2020struct TypeData;
    21 struct InitializerNode;
    22 
    23 struct DeclarationNode final : public ParseList<DeclarationNode> {
     21class InitializerNode;
     22
     23struct DeclarationNode : public ParseNode {
    2424        // These enumerations must harmonize with their names in DeclarationNode.cc.
    2525        enum BasicType {
     
    108108        DeclarationNode * cloneBaseType( DeclarationNode * newdecl, bool = true );
    109109
     110        DeclarationNode * appendList( DeclarationNode * node ) {
     111                return (DeclarationNode *)set_last( node );
     112        }
     113
    110114        virtual void print( __attribute__((unused)) std::ostream & os, __attribute__((unused)) int indent = 0 ) const override;
    111115        virtual void printList( __attribute__((unused)) std::ostream & os, __attribute__((unused)) int indent = 0 ) const override;
     
    125129        DeclarationNode * set_inLine( bool inL ) { inLine = inL; return this; }
    126130
    127         const std::string * name = nullptr;
     131        DeclarationNode * get_last() { return (DeclarationNode *)ParseNode::get_last(); }
    128132
    129133        struct Variable_t {
     
    140144        };
    141145        StaticAssert_t assert;
     146
     147        BuiltinType builtin = NoBuiltinType;
    142148
    143149        TypeData * type = nullptr;
     
    171177}
    172178
     179template<typename NodeType>
     180NodeType * strict_next( NodeType * node ) {
     181        ParseNode * next = node->get_next();
     182        if ( nullptr == next ) return nullptr;
     183        if ( NodeType * ret = dynamic_cast<NodeType *>( next ) ) return ret;
     184        SemanticError( next->location, "internal error, non-homogeneous nodes founds in buildList processing." );
     185}
     186
    173187// This generic buildList is here along side its overloads.
    174188template<typename AstType, typename NodeType,
     
    179193        std::back_insert_iterator<Container<ast::ptr<AstType>, Args...>> out( output );
    180194
    181         for ( NodeType * cur = firstNode ; cur ; cur = cur->next ) {
     195        for ( NodeType * cur = firstNode ; cur ; cur = strict_next( cur ) ) {
    182196                try {
    183197                        AstType * node = dynamic_cast<AstType *>( maybeBuild( cur ) );
Note: See TracChangeset for help on using the changeset viewer.