Changeset 835d6e8


Ignore:
Timestamp:
Apr 5, 2023, 4:45:38 PM (20 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
c468150
Parents:
3e94a23
Message:

ast::SuspendStmt::Type -> ::Kind, this fits the new convention where Type is limited for actual compiler types.

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r3e94a23 r835d6e8  
    559559                auto stmt = new SuspendStmt();
    560560                stmt->then   = get<CompoundStmt>().accept1( node->then   );
    561                 switch(node->type) {
     561                switch (node->kind) {
    562562                        case ast::SuspendStmt::None     : stmt->type = SuspendStmt::None     ; break;
    563563                        case ast::SuspendStmt::Coroutine: stmt->type = SuspendStmt::Coroutine; break;
     
    21312131        virtual void visit( const SuspendStmt * old ) override final {
    21322132                if ( inCache( old ) ) return;
    2133                 ast::SuspendStmt::Type type;
     2133                ast::SuspendStmt::Kind type;
    21342134                switch (old->type) {
    21352135                        case SuspendStmt::Coroutine: type = ast::SuspendStmt::Coroutine; break;
  • src/AST/Print.cpp

    r3e94a23 r835d6e8  
    739739        virtual const ast::Stmt * visit( const ast::SuspendStmt * node ) override final {
    740740                os << "Suspend Statement";
    741                 switch (node->type) {
    742                         case ast::SuspendStmt::None     : os << " with implicit target"; break;
    743                         case ast::SuspendStmt::Generator: os << " for generator"; break;
    744                         case ast::SuspendStmt::Coroutine: os << " for coroutine"; break;
     741                switch (node->kind) {
     742                case ast::SuspendStmt::None     : os << " with implicit target"; break;
     743                case ast::SuspendStmt::Generator: os << " for generator"; break;
     744                case ast::SuspendStmt::Coroutine: os << " for coroutine"; break;
    745745                }
    746746                os << endl;
  • src/AST/Stmt.hpp

    r3e94a23 r835d6e8  
    367367  public:
    368368        ptr<CompoundStmt> then;
    369         enum Type { None, Coroutine, Generator } type = None;
    370 
    371         SuspendStmt( const CodeLocation & loc, const CompoundStmt * then, Type type, const std::vector<Label> && labels = {} )
    372                 : Stmt(loc, std::move(labels)), then(then), type(type) {}
     369        enum Kind { None, Coroutine, Generator } kind = None;
     370
     371        SuspendStmt( const CodeLocation & loc, const CompoundStmt * then, Kind kind, const std::vector<Label> && labels = {} )
     372                : Stmt(loc, std::move(labels)), then(then), kind(kind) {}
    373373
    374374        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
  • src/Concurrency/KeywordsNew.cpp

    r3e94a23 r835d6e8  
    779779
    780780const ast::Stmt * SuspendKeyword::postvisit( const ast::SuspendStmt * stmt ) {
    781         switch ( stmt->type ) {
     781        switch ( stmt->kind ) {
    782782        case ast::SuspendStmt::None:
    783783                // Use the context to determain the implicit target.
  • src/Parser/ParseNode.h

    r3e94a23 r835d6e8  
    437437ast::Stmt * build_asm( const CodeLocation &, bool voltile, ast::Expr * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
    438438ast::Stmt * build_directive( const CodeLocation &, std::string * directive );
    439 ast::SuspendStmt * build_suspend( const CodeLocation &, StatementNode *, ast::SuspendStmt::Type );
     439ast::SuspendStmt * build_suspend( const CodeLocation &, StatementNode *, ast::SuspendStmt::Kind );
    440440ast::WaitForStmt * build_waitfor( const CodeLocation &, ast::WaitForStmt * existing, ExpressionNode * when, ExpressionNode * targetExpr, StatementNode * stmt );
    441441ast::WaitForStmt * build_waitfor_else( const CodeLocation &, ast::WaitForStmt * existing, ExpressionNode * when, StatementNode * stmt );
  • src/Parser/StatementNode.cc

    r3e94a23 r835d6e8  
    362362} // build_finally
    363363
    364 ast::SuspendStmt * build_suspend( const CodeLocation & location, StatementNode * then, ast::SuspendStmt::Type type ) {
     364ast::SuspendStmt * build_suspend( const CodeLocation & location, StatementNode * then, ast::SuspendStmt::Kind kind ) {
    365365        std::vector<ast::ptr<ast::Stmt>> stmts;
    366366        buildMoveList( then, stmts );
     
    370370                then2 = stmts.front().strict_as<ast::CompoundStmt>();
    371371        }
    372         auto node = new ast::SuspendStmt( location, then2, ast::SuspendStmt::None );
    373         node->type = type;
    374         return node;
     372        return new ast::SuspendStmt( location, then2, kind );
    375373} // build_suspend
    376374
Note: See TracChangeset for help on using the changeset viewer.