Ignore:
Timestamp:
Apr 10, 2023, 12:03:31 PM (3 years ago)
Author:
Mike Brooks <mlbrooks@…>
Branches:
ADT, ast-experimental, master
Children:
6adeb5f
Parents:
2b01f8e (diff), ea2759b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/StatementNode.cc

    r2b01f8e ra085470  
    1515//
    1616
     17#include "StatementNode.h"
     18
    1719#include <cassert>                 // for assert, strict_dynamic_cast, assertf
    1820#include <memory>                  // for unique_ptr
     
    2325#include "Common/SemanticError.h"  // for SemanticError
    2426#include "Common/utility.h"        // for maybeMoveBuild, maybeBuild
    25 #include "ParseNode.h"             // for StatementNode, ExpressionNode, bui...
     27#include "DeclarationNode.h"       // for DeclarationNode
     28#include "ExpressionNode.h"        // for ExpressionNode
    2629#include "parserutility.h"         // for notZeroExpr
    2730
     
    5255        stmt.reset( new ast::DeclStmt( declLocation, maybeMoveBuild( agg ) ) );
    5356} // StatementNode::StatementNode
     57
     58StatementNode * StatementNode::add_label(
     59                const CodeLocation & location,
     60                const std::string * name,
     61                DeclarationNode * attr ) {
     62        stmt->labels.emplace_back( location,
     63                *name,
     64                attr ? std::move( attr->attributes )
     65                        : std::vector<ast::ptr<ast::Attribute>>{} );
     66        delete attr;
     67        delete name;
     68        return this;
     69}
    5470
    5571StatementNode * StatementNode::append_last_case( StatementNode * stmt ) {
     
    218234                astelse.empty() ? nullptr : astelse.front().release(),
    219235                std::move( astinit ),
    220                 false
     236                ast::While
    221237        );
    222238} // build_while
     
    237253                astelse.empty() ? nullptr : astelse.front().release(),
    238254                {},
    239                 true
     255                ast::DoWhile
    240256        );
    241257} // build_do_while
     
    362378} // build_finally
    363379
    364 ast::SuspendStmt * build_suspend( const CodeLocation & location, StatementNode * then, ast::SuspendStmt::Type type ) {
     380ast::SuspendStmt * build_suspend( const CodeLocation & location, StatementNode * then, ast::SuspendStmt::Kind kind ) {
    365381        std::vector<ast::ptr<ast::Stmt>> stmts;
    366382        buildMoveList( then, stmts );
     
    370386                then2 = stmts.front().strict_as<ast::CompoundStmt>();
    371387        }
    372         auto node = new ast::SuspendStmt( location, then2, ast::SuspendStmt::None );
    373         node->type = type;
    374         return node;
     388        return new ast::SuspendStmt( location, then2, kind );
    375389} // build_suspend
    376390
Note: See TracChangeset for help on using the changeset viewer.