Changeset a085470 for src/Parser/StatementNode.cc
- Timestamp:
- Apr 10, 2023, 12:03:31 PM (3 years ago)
- 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. - File:
-
- 1 edited
-
src/Parser/StatementNode.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/StatementNode.cc
r2b01f8e ra085470 15 15 // 16 16 17 #include "StatementNode.h" 18 17 19 #include <cassert> // for assert, strict_dynamic_cast, assertf 18 20 #include <memory> // for unique_ptr … … 23 25 #include "Common/SemanticError.h" // for SemanticError 24 26 #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 26 29 #include "parserutility.h" // for notZeroExpr 27 30 … … 52 55 stmt.reset( new ast::DeclStmt( declLocation, maybeMoveBuild( agg ) ) ); 53 56 } // StatementNode::StatementNode 57 58 StatementNode * 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 } 54 70 55 71 StatementNode * StatementNode::append_last_case( StatementNode * stmt ) { … … 218 234 astelse.empty() ? nullptr : astelse.front().release(), 219 235 std::move( astinit ), 220 false236 ast::While 221 237 ); 222 238 } // build_while … … 237 253 astelse.empty() ? nullptr : astelse.front().release(), 238 254 {}, 239 true255 ast::DoWhile 240 256 ); 241 257 } // build_do_while … … 362 378 } // build_finally 363 379 364 ast::SuspendStmt * build_suspend( const CodeLocation & location, StatementNode * then, ast::SuspendStmt:: Type type) {380 ast::SuspendStmt * build_suspend( const CodeLocation & location, StatementNode * then, ast::SuspendStmt::Kind kind ) { 365 381 std::vector<ast::ptr<ast::Stmt>> stmts; 366 382 buildMoveList( then, stmts ); … … 370 386 then2 = stmts.front().strict_as<ast::CompoundStmt>(); 371 387 } 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 ); 375 389 } // build_suspend 376 390
Note:
See TracChangeset
for help on using the changeset viewer.