diff options
author | lrh2000 <lrh2000@pku.edu.cn> | 2021-04-10 22:53:32 +0800 |
---|---|---|
committer | lrh2000 <lrh2000@pku.edu.cn> | 2021-04-18 10:11:53 +0800 |
commit | c5fdf8cc544f9647e2cf28a2da431bfa1faacd15 (patch) | |
tree | f67b95885d2f3573acd86e815750e0e1ec92b58f /gcc/rust/parse/rust-parse.h | |
parent | 498758a1c238a539b364ac2c632742a9b64ab4a5 (diff) | |
download | gcc-c5fdf8cc544f9647e2cf28a2da431bfa1faacd15.zip gcc-c5fdf8cc544f9647e2cf28a2da431bfa1faacd15.tar.gz gcc-c5fdf8cc544f9647e2cf28a2da431bfa1faacd15.tar.bz2 |
The trailing expression is not necessarily without a block
Diffstat (limited to 'gcc/rust/parse/rust-parse.h')
-rw-r--r-- | gcc/rust/parse/rust-parse.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h index f6faa96..47f55ea 100644 --- a/gcc/rust/parse/rust-parse.h +++ b/gcc/rust/parse/rust-parse.h @@ -27,7 +27,7 @@ namespace Rust { * probably take up the same amount of space. */ struct ExprOrStmt { - std::unique_ptr<AST::ExprWithoutBlock> expr; + std::unique_ptr<AST::Expr> expr; std::unique_ptr<AST::Stmt> stmt; /* I was going to resist the urge to make this a real class and make it POD, @@ -35,9 +35,7 @@ struct ExprOrStmt * constructor. */ // expression constructor - ExprOrStmt (std::unique_ptr<AST::ExprWithoutBlock> expr) - : expr (std::move (expr)) - {} + ExprOrStmt (std::unique_ptr<AST::Expr> expr) : expr (std::move (expr)) {} // statement constructor ExprOrStmt (std::unique_ptr<AST::Stmt> stmt) : stmt (std::move (stmt)) {} @@ -63,9 +61,7 @@ struct ExprOrStmt private: // private constructor only used for creating error state expr or stmt objects - ExprOrStmt (AST::ExprWithoutBlock *expr, AST::Stmt *stmt) - : expr (expr), stmt (stmt) - {} + ExprOrStmt (AST::Expr *expr, AST::Stmt *stmt) : expr (expr), stmt (stmt) {} // make this work: have a disambiguation specifically for known statements // (i.e. ';' and 'let'). then, have a special "parse expr or stmt" function @@ -487,6 +483,8 @@ private: ParseRestrictions restrictions = ParseRestrictions ()); // Expression-related (non-Pratt parsed) + std::unique_ptr<AST::ExprWithBlock> + parse_expr_with_block (std::vector<AST::Attribute> outer_attrs); std::unique_ptr<AST::ExprWithoutBlock> parse_expr_without_block (std::vector<AST::Attribute> outer_attrs = std::vector<AST::Attribute> ()); @@ -592,6 +590,8 @@ private: parse_expr_stmt_without_block (std::vector<AST::Attribute> outer_attrs); ExprOrStmt parse_stmt_or_expr_without_block (); ExprOrStmt + parse_stmt_or_expr_with_block (std::vector<AST::Attribute> outer_attrs); + ExprOrStmt parse_macro_invocation_maybe_semi (std::vector<AST::Attribute> outer_attrs); ExprOrStmt parse_path_based_stmt_or_expr (std::vector<AST::Attribute> outer_attrs); |