Changeset eb779d5 for src/AST


Ignore:
Timestamp:
Oct 9, 2023, 12:55:09 PM (16 months ago)
Author:
caparsons <caparson@…>
Branches:
master
Children:
26dfce5
Parents:
0d49efb
Message:

Implemented corun statement

Location:
src/AST
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r0d49efb reb779d5  
    650650        }
    651651
     652    const ast::Stmt * visit( const ast::CorunStmt * node ) override final {
     653        // There is no old-AST CorunStmt, so this should never be called.
     654                assert( !node );
     655                return nullptr;
     656        }
     657
    652658        TypeSubstitution * convertTypeSubstitution(const ast::TypeSubstitution * src) {
    653659
  • src/AST/Fwd.hpp

    r0d49efb reb779d5  
    6767class ImplicitCtorDtorStmt;
    6868class MutexStmt;
     69class CorunStmt;
    6970
    7071class Expr;
  • src/AST/Node.cpp

    r0d49efb reb779d5  
    192192template class ast::ptr_base< ast::MutexStmt, ast::Node::ref_type::weak >;
    193193template class ast::ptr_base< ast::MutexStmt, ast::Node::ref_type::strong >;
     194template class ast::ptr_base< ast::CorunStmt, ast::Node::ref_type::weak >;
     195template class ast::ptr_base< ast::CorunStmt, ast::Node::ref_type::strong >;
    194196template class ast::ptr_base< ast::Expr, ast::Node::ref_type::weak >;
    195197template class ast::ptr_base< ast::Expr, ast::Node::ref_type::strong >;
  • src/AST/Pass.hpp

    r0d49efb reb779d5  
    171171        const ast::Stmt *             visit( const ast::ImplicitCtorDtorStmt * ) override final;
    172172        const ast::Stmt *             visit( const ast::MutexStmt            * ) override final;
     173    const ast::Stmt *             visit( const ast::CorunStmt            * ) override final;
    173174        const ast::Expr *             visit( const ast::ApplicationExpr      * ) override final;
    174175        const ast::Expr *             visit( const ast::UntypedExpr          * ) override final;
  • src/AST/Pass.impl.hpp

    r0d49efb reb779d5  
    11211121
    11221122//--------------------------------------------------------------------------
     1123// CorunStmt
     1124template< typename core_t >
     1125const ast::Stmt * ast::Pass< core_t >::visit( const ast::CorunStmt * node ) {
     1126        VISIT_START( node );
     1127
     1128        if ( __visit_children() ) {
     1129                maybe_accept( node, &CorunStmt::stmt );
     1130        }
     1131
     1132        VISIT_END( Stmt, node );
     1133}
     1134
     1135//--------------------------------------------------------------------------
    11231136// ApplicationExpr
    11241137template< typename core_t >
  • src/AST/Print.cpp

    r0d49efb reb779d5  
    922922        }
    923923
     924    virtual const ast::Stmt * visit( const ast::CorunStmt * node ) override final {
     925                os << "Corun Statement" << endl;
     926                os << indent << "... with Statement: ";
     927                ++indent;
     928                safe_print( node->stmt );
     929                --indent;
     930                os << endl;
     931
     932                return node;
     933        }
     934
    924935        virtual const ast::Expr * visit( const ast::ApplicationExpr * node ) override final {
    925936                ++indent;
  • src/AST/Stmt.hpp

    r0d49efb reb779d5  
    532532};
    533533
     534// Corun Statement
     535class CorunStmt final : public Stmt {
     536  public:
     537        ptr<Stmt> stmt;
     538
     539        CorunStmt( const CodeLocation & loc, const Stmt * stmt, const std::vector<Label> && labels = {} )
     540                : Stmt(loc, std::move(labels)), stmt(stmt) {}
     541
     542        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     543  private:
     544        CorunStmt * clone() const override { return new CorunStmt{ *this }; }
     545        MUTATE_FRIEND
     546};
     547
    534548} // namespace ast
    535549
  • src/AST/Visitor.hpp

    r0d49efb reb779d5  
    5959    virtual const ast::Stmt *             visit( const ast::ImplicitCtorDtorStmt * ) = 0;
    6060    virtual const ast::Stmt *             visit( const ast::MutexStmt            * ) = 0;
     61    virtual const ast::Stmt *             visit( const ast::CorunStmt            * ) = 0;
    6162    virtual const ast::Expr *             visit( const ast::ApplicationExpr      * ) = 0;
    6263    virtual const ast::Expr *             visit( const ast::UntypedExpr          * ) = 0;
Note: See TracChangeset for help on using the changeset viewer.