Ignore:
Timestamp:
Apr 4, 2023, 2:25:52 PM (13 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
beeff61e, e02e13f
Parents:
4541b09
Message:

Translated parser to the new ast. This incuded a small fix in the resolver so larger expressions can be used in with statements and some updated tests. errors/declaration just is a formatting update. attributes now actually preserves more attributes (unknown if all versions work).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r4541b09 rbb7422a  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:28:16 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 29 08:40:27 2023
    13 // Update Count     : 948
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Apr  3 17:55:00 2023
     13// Update Count     : 942
    1414//
    1515
     
    2424#include <string>                  // for string
    2525
     26#include "AST/Expr.hpp"            // for Expr, NameExpr LogicalFlag
     27#include "AST/Fwd.hpp"             // for ptr, Decl, DeclWithType,
     28#include "AST/Stmt.hpp"            // for Stmt
    2629#include "Common/CodeLocation.h"   // for CodeLocation
    2730#include "Common/SemanticError.h"  // for SemanticError
    2831#include "Common/UniqueName.h"     // for UniqueName
    2932#include "Common/utility.h"        // for maybeClone
    30 #include "Parser/parserutility.h"  // for maybeBuild
    31 #include "SynTree/LinkageSpec.h"   // for Spec
    32 #include "SynTree/Declaration.h"   // for Aggregate
    33 #include "SynTree/Expression.h"    // for Expression, ConstantExpr (ptr only)
    34 #include "SynTree/Label.h"         // for Label
    35 #include "SynTree/Statement.h"     // for Statement, BranchStmt, BranchStmt:...
    36 #include "SynTree/Type.h"          // for Type, Type::FuncSpecifiers, Type::...
     33#include "Parser/parserutility.h"  // for maybeBuild, maybeCopy
    3734
    3835class Attribute;
     
    108105        void printOneLine( std::ostream & ) const;
    109106
    110         virtual Initializer * build() const;
     107        virtual ast::Init * build() const;
    111108  private:
    112109        ExpressionNode * expr;
     
    122119class ExpressionNode final : public ParseNode {
    123120  public:
    124         ExpressionNode( Expression * expr = nullptr ) : expr( expr ) {}
     121        ExpressionNode( ast::Expr * expr = nullptr ) : expr( expr ) {}
    125122        virtual ~ExpressionNode() {}
    126         virtual ExpressionNode * clone() const override { return expr ? static_cast<ExpressionNode*>((new ExpressionNode( expr->clone() ))->set_next( maybeClone( get_next() ) )) : nullptr; }
     123        virtual ExpressionNode * clone() const override {
     124                if ( nullptr == expr ) return nullptr;
     125                return static_cast<ExpressionNode*>(
     126                        (new ExpressionNode( ast::shallowCopy( expr.get() ) ))->set_next( maybeCopy( get_next() ) ));
     127        }
    127128
    128129        bool get_extension() const { return extension; }
     
    137138        bool isExpressionType() const { return nullptr != dynamic_cast<T>(expr.get()); }
    138139
    139         Expression * build() const {
    140                 Expression * node = const_cast<ExpressionNode *>(this)->expr.release();
     140        ast::Expr * build() const {
     141                ast::Expr * node = const_cast<ExpressionNode *>(this)->expr.release();
    141142                node->set_extension( this->get_extension() );
    142143                node->location = this->location;
     
    144145        }
    145146
    146         std::unique_ptr<Expression> expr;                                       // public because of lifetime implications
     147        // Public because of lifetime implications (what lifetime implications?)
     148        std::unique_ptr<ast::Expr> expr;
    147149  private:
    148150        bool extension = false;
     
    164166
    165167struct LabelNode {
    166         std::list< Label > labels;
     168        std::vector<ast::Label> labels;
    167169};
    168170
    169 Expression * build_constantInteger( std::string & str ); // these 4 routines modify the string
    170 Expression * build_constantFloat( std::string & str );
    171 Expression * build_constantChar( std::string & str );
    172 Expression * build_constantStr( std::string & str );
    173 Expression * build_field_name_FLOATING_FRACTIONconstant( const std::string & str );
    174 Expression * build_field_name_FLOATING_DECIMALconstant( const std::string & str );
    175 Expression * build_field_name_FLOATINGconstant( const std::string & str );
    176 Expression * build_field_name_fraction_constants( Expression * fieldName, ExpressionNode * fracts );
    177 
    178 NameExpr * build_varref( const std::string * name );
    179 QualifiedNameExpr * build_qualified_expr( const DeclarationNode * decl_node, const NameExpr * name );
    180 QualifiedNameExpr * build_qualified_expr( const EnumDecl * decl, const NameExpr * name );
    181 DimensionExpr * build_dimensionref( const std::string * name );
    182 
    183 Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node );
    184 Expression * build_keyword_cast( AggregateDecl::Aggregate target, ExpressionNode * expr_node );
    185 Expression * build_virtual_cast( DeclarationNode * decl_node, ExpressionNode * expr_node );
    186 Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member );
    187 Expression * build_pfieldSel( ExpressionNode * expr_node, Expression * member );
    188 Expression * build_offsetOf( DeclarationNode * decl_node, NameExpr * member );
    189 Expression * build_and( ExpressionNode * expr_node1, ExpressionNode * expr_node2 );
    190 Expression * build_and_or( ExpressionNode * expr_node1, ExpressionNode * expr_node2, bool kind );
    191 Expression * build_unary_val( OperKinds op, ExpressionNode * expr_node );
    192 Expression * build_binary_val( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 );
    193 Expression * build_binary_ptr( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 );
    194 Expression * build_cond( ExpressionNode * expr_node1, ExpressionNode * expr_node2, ExpressionNode * expr_node3 );
    195 Expression * build_tuple( ExpressionNode * expr_node = nullptr );
    196 Expression * build_func( ExpressionNode * function, ExpressionNode * expr_node );
    197 Expression * build_compoundLiteral( DeclarationNode * decl_node, InitializerNode * kids );
     171// These 4 routines modify the string:
     172ast::Expr * build_constantInteger( const CodeLocation &, std::string & );
     173ast::Expr * build_constantFloat( const CodeLocation &, std::string & );
     174ast::Expr * build_constantChar( const CodeLocation &, std::string & );
     175ast::Expr * build_constantStr( const CodeLocation &, std::string & );
     176ast::Expr * build_field_name_FLOATING_FRACTIONconstant( const CodeLocation &, const std::string & str );
     177ast::Expr * build_field_name_FLOATING_DECIMALconstant( const CodeLocation &, const std::string & str );
     178ast::Expr * build_field_name_FLOATINGconstant( const CodeLocation &, const std::string & str );
     179ast::Expr * build_field_name_fraction_constants( const CodeLocation &, ast::Expr * fieldName, ExpressionNode * fracts );
     180
     181ast::NameExpr * build_varref( const CodeLocation &, const std::string * name );
     182ast::QualifiedNameExpr * build_qualified_expr( const CodeLocation &, const DeclarationNode * decl_node, const ast::NameExpr * name );
     183ast::QualifiedNameExpr * build_qualified_expr( const CodeLocation &, const ast::EnumDecl * decl, const ast::NameExpr * name );
     184ast::DimensionExpr * build_dimensionref( const CodeLocation &, const std::string * name );
     185
     186ast::Expr * build_cast( const CodeLocation &, DeclarationNode * decl_node, ExpressionNode * expr_node );
     187ast::Expr * build_keyword_cast( const CodeLocation &, ast::AggregateDecl::Aggregate target, ExpressionNode * expr_node );
     188ast::Expr * build_virtual_cast( const CodeLocation &, DeclarationNode * decl_node, ExpressionNode * expr_node );
     189ast::Expr * build_fieldSel( const CodeLocation &, ExpressionNode * expr_node, ast::Expr * member );
     190ast::Expr * build_pfieldSel( const CodeLocation &, ExpressionNode * expr_node, ast::Expr * member );
     191ast::Expr * build_offsetOf( const CodeLocation &, DeclarationNode * decl_node, ast::NameExpr * member );
     192ast::Expr * build_and( const CodeLocation &, ExpressionNode * expr_node1, ExpressionNode * expr_node2 );
     193ast::Expr * build_and_or( const CodeLocation &, ExpressionNode * expr_node1, ExpressionNode * expr_node2, ast::LogicalFlag flag );
     194ast::Expr * build_unary_val( const CodeLocation &, OperKinds op, ExpressionNode * expr_node );
     195ast::Expr * build_binary_val( const CodeLocation &, OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 );
     196ast::Expr * build_binary_ptr( const CodeLocation &, OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 );
     197ast::Expr * build_cond( const CodeLocation &, ExpressionNode * expr_node1, ExpressionNode * expr_node2, ExpressionNode * expr_node3 );
     198ast::Expr * build_tuple( const CodeLocation &, ExpressionNode * expr_node = nullptr );
     199ast::Expr * build_func( const CodeLocation &, ExpressionNode * function, ExpressionNode * expr_node );
     200ast::Expr * build_compoundLiteral( const CodeLocation &, DeclarationNode * decl_node, InitializerNode * kids );
    198201
    199202//##############################################################################
     
    219222        static const char * builtinTypeNames[];
    220223
    221         static DeclarationNode * newStorageClass( Type::StorageClasses );
    222         static DeclarationNode * newFuncSpecifier( Type::FuncSpecifiers );
    223         static DeclarationNode * newTypeQualifier( Type::Qualifiers );
     224        static DeclarationNode * newStorageClass( ast::Storage::Classes );
     225        static DeclarationNode * newFuncSpecifier( ast::Function::Specs );
     226        static DeclarationNode * newTypeQualifier( ast::CV::Qualifiers );
    224227        static DeclarationNode * newBasicType( BasicType );
    225228        static DeclarationNode * newComplexType( ComplexType );
     
    232235        static DeclarationNode * newQualifiedType( DeclarationNode *, DeclarationNode * );
    233236        static DeclarationNode * newFunction( const std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body );
    234         static DeclarationNode * newAggregate( AggregateDecl::Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body );
     237        static DeclarationNode * newAggregate( ast::AggregateDecl::Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body );
    235238        static DeclarationNode * newEnum( const std::string * name, DeclarationNode * constants, bool body, bool typed, DeclarationNode * base = nullptr, EnumHiding hiding = EnumHiding::Visible );
    236239        static DeclarationNode * newEnumConstant( const std::string * name, ExpressionNode * constant );
     
    239242        static DeclarationNode * newName( const std::string * );
    240243        static DeclarationNode * newFromTypeGen( const std::string *, ExpressionNode * params );
    241         static DeclarationNode * newTypeParam( TypeDecl::Kind, const std::string * );
     244        static DeclarationNode * newTypeParam( ast::TypeDecl::Kind, const std::string * );
    242245        static DeclarationNode * newTrait( const std::string * name, DeclarationNode * params, DeclarationNode * asserts );
    243246        static DeclarationNode * newTraitUse( const std::string * name, ExpressionNode * params );
     
    253256        static DeclarationNode * newDirectiveStmt( StatementNode * stmt ); // gcc external directive statement
    254257        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
    255         static DeclarationNode * newStaticAssert( ExpressionNode * condition, Expression * message );
     258        static DeclarationNode * newStaticAssert( ExpressionNode * condition, ast::Expr * message );
    256259
    257260        DeclarationNode();
     
    294297        virtual void printList( __attribute__((unused)) std::ostream & os, __attribute__((unused)) int indent = 0 ) const override;
    295298
    296         Declaration * build() const;
    297         Type * buildType() const;
    298 
    299         LinkageSpec::Spec get_linkage() const { return linkage; }
     299        ast::Decl * build() const;
     300        ast::Type * buildType() const;
     301
     302        ast::Linkage::Spec get_linkage() const { return linkage; }
    300303        DeclarationNode * extractAggregate() const;
    301304        bool has_enumeratorValue() const { return (bool)enumeratorValue; }
     
    312315        struct Variable_t {
    313316//              const std::string * name;
    314                 TypeDecl::Kind tyClass;
     317                ast::TypeDecl::Kind tyClass;
    315318                DeclarationNode * assertions;
    316319                DeclarationNode * initializer;
     
    320323        struct StaticAssert_t {
    321324                ExpressionNode * condition;
    322                 Expression * message;
     325                ast::Expr * message;
    323326        };
    324327        StaticAssert_t assert;
     
    330333        bool inLine = false;
    331334        bool enumInLine = false;
    332         Type::FuncSpecifiers funcSpecs;
    333         Type::StorageClasses storageClasses;
     335        ast::Function::Specs funcSpecs;
     336        ast::Storage::Classes storageClasses;
    334337
    335338        ExpressionNode * bitfieldWidth = nullptr;
    336339        std::unique_ptr<ExpressionNode> enumeratorValue;
    337340        bool hasEllipsis = false;
    338         LinkageSpec::Spec linkage;
    339         Expression * asmName = nullptr;
    340         std::list< Attribute * > attributes;
     341        ast::Linkage::Spec linkage;
     342        ast::Expr * asmName = nullptr;
     343        std::vector<ast::ptr<ast::Attribute>> attributes;
    341344        InitializerNode * initializer = nullptr;
    342345        bool extension = false;
     
    348351}; // DeclarationNode
    349352
    350 Type * buildType( TypeData * type );
    351 
    352 static inline Type * maybeMoveBuildType( const DeclarationNode * orig ) {
    353         Type * ret = orig ? orig->buildType() : nullptr;
     353ast::Type * buildType( TypeData * type );
     354
     355static inline ast::Type * maybeMoveBuildType( const DeclarationNode * orig ) {
     356        ast::Type * ret = orig ? orig->buildType() : nullptr;
    354357        delete orig;
    355358        return ret;
     
    359362
    360363struct StatementNode final : public ParseNode {
    361         StatementNode() { stmt = nullptr; }
    362         StatementNode( Statement * stmt ) : stmt( stmt ) {}
     364        StatementNode() :
     365                stmt( nullptr ), clause( nullptr ) {}
     366        StatementNode( ast::Stmt * stmt ) :
     367                stmt( stmt ), clause( nullptr ) {}
     368        StatementNode( ast::StmtClause * clause ) :
     369                stmt( nullptr ), clause( clause ) {}
    363370        StatementNode( DeclarationNode * decl );
    364371        virtual ~StatementNode() {}
    365372
    366373        virtual StatementNode * clone() const final { assert( false ); return nullptr; }
    367         Statement * build() const { return const_cast<StatementNode *>(this)->stmt.release(); }
    368 
    369         virtual StatementNode * add_label( const std::string * name, DeclarationNode * attr = nullptr ) {
    370                 stmt->get_labels().emplace_back( * name, nullptr, attr ? std::move( attr->attributes ) : std::list< Attribute * > {} );
     374        ast::Stmt * build() const { return const_cast<StatementNode *>(this)->stmt.release(); }
     375
     376        virtual StatementNode * add_label(
     377                        const CodeLocation & location,
     378                        const std::string * name,
     379                        DeclarationNode * attr = nullptr ) {
     380                stmt->labels.emplace_back( location,
     381                        *name,
     382                        attr ? std::move( attr->attributes )
     383                                : std::vector<ast::ptr<ast::Attribute>>{} );
    371384                delete attr;
    372385                delete name;
     
    380393        }
    381394
    382         std::unique_ptr<Statement> stmt;
     395        std::unique_ptr<ast::Stmt> stmt;
     396        std::unique_ptr<ast::StmtClause> clause;
    383397}; // StatementNode
    384398
    385 Statement * build_expr( ExpressionNode * ctl );
     399ast::Stmt * build_expr( CodeLocation const &, ExpressionNode * ctl );
    386400
    387401struct CondCtl {
     
    402416};
    403417
    404 Expression * build_if_control( CondCtl * ctl, std::list< Statement * > & init );
    405 Statement * build_if( CondCtl * ctl, StatementNode * then, StatementNode * else_ );
    406 Statement * build_switch( bool isSwitch, ExpressionNode * ctl, StatementNode * stmt );
    407 Statement * build_case( ExpressionNode * ctl );
    408 Statement * build_default();
    409 Statement * build_while( CondCtl * ctl, StatementNode * stmt, StatementNode * else_ = nullptr );
    410 Statement * build_do_while( ExpressionNode * ctl, StatementNode * stmt, StatementNode * else_ = nullptr );
    411 Statement * build_for( ForCtrl * forctl, StatementNode * stmt, StatementNode * else_ = nullptr );
    412 Statement * build_branch( BranchStmt::Type kind );
    413 Statement * build_branch( std::string * identifier, BranchStmt::Type kind );
    414 Statement * build_computedgoto( ExpressionNode * ctl );
    415 Statement * build_return( ExpressionNode * ctl );
    416 Statement * build_throw( ExpressionNode * ctl );
    417 Statement * build_resume( ExpressionNode * ctl );
    418 Statement * build_resume_at( ExpressionNode * ctl , ExpressionNode * target );
    419 Statement * build_try( StatementNode * try_, StatementNode * catch_, StatementNode * finally_ );
    420 Statement * build_catch( CatchStmt::Kind kind, DeclarationNode * decl, ExpressionNode * cond, StatementNode * body );
    421 Statement * build_finally( StatementNode * stmt );
    422 Statement * build_compound( StatementNode * first );
    423 StatementNode * maybe_build_compound( StatementNode * first );
    424 Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
    425 Statement * build_directive( std::string * directive );
    426 SuspendStmt * build_suspend( StatementNode *, SuspendStmt::Type = SuspendStmt::None);
    427 WaitForStmt * build_waitfor( WaitForStmt * existing, ExpressionNode * when, ExpressionNode * targetExpr, StatementNode * stmt );
    428 WaitForStmt * build_waitfor_else( WaitForStmt * existing, ExpressionNode * when, StatementNode * stmt );
    429 WaitForStmt * build_waitfor_timeout( WaitForStmt * existing, ExpressionNode * when, ExpressionNode * timeout, StatementNode * stmt );
    430 Statement * build_with( ExpressionNode * exprs, StatementNode * stmt );
    431 Statement * build_mutex( ExpressionNode * exprs, StatementNode * stmt );
    432 
    433 //##############################################################################
    434 
    435 template< typename SynTreeType, typename NodeType, template< typename, typename...> class Container, typename... Args >
    436 void buildList( const NodeType * firstNode, Container< SynTreeType *, Args... > & outputList ) {
     418ast::Stmt * build_if( const CodeLocation &, CondCtl * ctl, StatementNode * then, StatementNode * else_ );
     419ast::Stmt * build_switch( const CodeLocation &, bool isSwitch, ExpressionNode * ctl, StatementNode * stmt );
     420ast::CaseClause * build_case( ExpressionNode * ctl );
     421ast::CaseClause * build_default( const CodeLocation & );
     422ast::Stmt * build_while( const CodeLocation &, CondCtl * ctl, StatementNode * stmt, StatementNode * else_ = nullptr );
     423ast::Stmt * build_do_while( const CodeLocation &, ExpressionNode * ctl, StatementNode * stmt, StatementNode * else_ = nullptr );
     424ast::Stmt * build_for( const CodeLocation &, ForCtrl * forctl, StatementNode * stmt, StatementNode * else_ = nullptr );
     425ast::Stmt * build_branch( const CodeLocation &, ast::BranchStmt::Kind kind );
     426ast::Stmt * build_branch( const CodeLocation &, std::string * identifier, ast::BranchStmt::Kind kind );
     427ast::Stmt * build_computedgoto( ExpressionNode * ctl );
     428ast::Stmt * build_return( const CodeLocation &, ExpressionNode * ctl );
     429ast::Stmt * build_throw( const CodeLocation &, ExpressionNode * ctl );
     430ast::Stmt * build_resume( const CodeLocation &, ExpressionNode * ctl );
     431ast::Stmt * build_resume_at( ExpressionNode * ctl , ExpressionNode * target );
     432ast::Stmt * build_try( const CodeLocation &, StatementNode * try_, StatementNode * catch_, StatementNode * finally_ );
     433ast::CatchClause * build_catch( const CodeLocation &, ast::ExceptionKind kind, DeclarationNode * decl, ExpressionNode * cond, StatementNode * body );
     434ast::FinallyClause * build_finally( const CodeLocation &, StatementNode * stmt );
     435ast::Stmt * build_compound( const CodeLocation &, StatementNode * first );
     436StatementNode * maybe_build_compound( const CodeLocation &, StatementNode * first );
     437ast::Stmt * build_asm( const CodeLocation &, bool voltile, ast::Expr * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
     438ast::Stmt * build_directive( const CodeLocation &, std::string * directive );
     439ast::SuspendStmt * build_suspend( const CodeLocation &, StatementNode *, ast::SuspendStmt::Type );
     440ast::WaitForStmt * build_waitfor( const CodeLocation &, ast::WaitForStmt * existing, ExpressionNode * when, ExpressionNode * targetExpr, StatementNode * stmt );
     441ast::WaitForStmt * build_waitfor_else( const CodeLocation &, ast::WaitForStmt * existing, ExpressionNode * when, StatementNode * stmt );
     442ast::WaitForStmt * build_waitfor_timeout( const CodeLocation &, ast::WaitForStmt * existing, ExpressionNode * when, ExpressionNode * timeout, StatementNode * stmt );
     443ast::Stmt * build_with( const CodeLocation &, ExpressionNode * exprs, StatementNode * stmt );
     444ast::Stmt * build_mutex( const CodeLocation &, ExpressionNode * exprs, StatementNode * stmt );
     445
     446//##############################################################################
     447
     448template<typename AstType, typename NodeType,
     449        template<typename, typename...> class Container, typename... Args>
     450void buildList( const NodeType * firstNode,
     451                Container<ast::ptr<AstType>, Args...> & output ) {
    437452        SemanticErrorException errors;
    438         std::back_insert_iterator< Container< SynTreeType *, Args... > > out( outputList );
     453        std::back_insert_iterator<Container<ast::ptr<AstType>, Args...>> out( output );
    439454        const NodeType * cur = firstNode;
    440455
    441456        while ( cur ) {
    442457                try {
    443                         SynTreeType * result = dynamic_cast< SynTreeType * >( maybeBuild( cur ) );
    444                         if ( result ) {
    445                                 result->location = cur->location;
    446                                 * out++ = result;
     458                        if ( auto result = dynamic_cast<AstType *>( maybeBuild( cur ) ) ) {
     459                                *out++ = result;
    447460                        } else {
     461                                assertf(false, __PRETTY_FUNCTION__ );
    448462                                SemanticError( cur->location, "type specifier declaration in forall clause is currently unimplemented." );
    449463                        } // if
     
    451465                        errors.append( e );
    452466                } // try
    453                 const ParseNode * temp = (cur->get_next());
    454                 cur = dynamic_cast< const NodeType * >( temp ); // should not return nullptr
    455                 if ( ! cur && temp ) {                                                  // non-homogeneous nodes ?
     467                const ParseNode * temp = cur->get_next();
     468                // Should not return nullptr, then it is non-homogeneous:
     469                cur = dynamic_cast<const NodeType *>( temp );
     470                if ( !cur && temp ) {
    456471                        SemanticError( temp->location, "internal error, non-homogeneous nodes founds in buildList processing." );
    457472                } // if
     
    463478
    464479// in DeclarationNode.cc
    465 void buildList( const DeclarationNode * firstNode, std::list< Declaration * > & outputList );
    466 void buildList( const DeclarationNode * firstNode, std::list< DeclarationWithType * > & outputList );
    467 void buildTypeList( const DeclarationNode * firstNode, std::list< Type * > & outputList );
    468 
    469 template< typename SynTreeType, typename NodeType >
    470 void buildMoveList( const NodeType * firstNode, std::list< SynTreeType * > & outputList ) {
    471         buildList( firstNode, outputList );
     480void buildList( const DeclarationNode * firstNode, std::vector<ast::ptr<ast::Decl>> & outputList );
     481void buildList( const DeclarationNode * firstNode, std::vector<ast::ptr<ast::DeclWithType>> & outputList );
     482void buildTypeList( const DeclarationNode * firstNode, std::vector<ast::ptr<ast::Type>> & outputList );
     483
     484template<typename AstType, typename NodeType,
     485        template<typename, typename...> class Container, typename... Args>
     486void buildMoveList( const NodeType * firstNode,
     487                Container<ast::ptr<AstType>, Args...> & output ) {
     488        buildList<AstType, NodeType, Container, Args...>( firstNode, output );
    472489        delete firstNode;
    473490}
Note: See TracChangeset for help on using the changeset viewer.