diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2023-03-15 23:30:19 -0400 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:34:08 +0100 |
commit | f2df348dcd5c7ef51e5a686a4d2473ae9bbb36bb (patch) | |
tree | b04421abddf75f0a0f5ebf5ece8b00c194c1a4ef /gcc/rust | |
parent | 7d8de1ca4a78ec7bf9cdd7e5cbe9d11bd2546efe (diff) | |
download | gcc-f2df348dcd5c7ef51e5a686a4d2473ae9bbb36bb.zip gcc-f2df348dcd5c7ef51e5a686a4d2473ae9bbb36bb.tar.gz gcc-f2df348dcd5c7ef51e5a686a4d2473ae9bbb36bb.tar.bz2 |
gccrs: Unify AST::IfLetExprConseqIf{,Let} into AST::IfLetExprConseqElse
This simplifies the AST's representation of if-let-statements
to match the HIR.
gcc/rust/ChangeLog:
* ast/rust-expr.h
(class IfLetExprConseqElse): Make else_block ExprWithBlock.
(class IfLetExprConseqIf): Remove.
(class IfLetExprConseqIfLet): Remove.
* ast/rust-ast-full-decls.h
(class IfLetExprConseqIf): Remove.
(class IfLetExprConseqIfLet): Remove.
* ast/rust-ast.cc
(IfLetExprConseqElse::as_string): Adjust output.
(IfLetExprConseqIf::as_string): Remove.
(IfLetExprConseqIfLet::as_string): Remove.
(IfLetExprConseqIf::accept_vis): Remove.
(IfLetExprConseqIfLet::accept_vis): Remove.
* ast/rust-ast-visitor.h
(ASTVisitor::visit): Remove IfLetExprConseqIf{,Let} visitors.
* ast/rust-ast-dump.cc
(Dump::visit): Likewise.
* ast/rust-ast-dump.h:
(Dump::visit): Likewise.
* ast/rust-ast-tokenstream.cc
(TokenStream::visit): Likewise.
* ast/rust-ast-tokenstream.h
(TokenStream::visit): Likewise.
* util/rust-attributes.cc
(AttributeChecker::visit): Likewise.
* util/rust-attributes.h:
(AttributeChecker::visit): Likewise.
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit): Likewise.
* resolve/rust-early-name-resolver.h
(EarlyNameResolver::visit): Likewise.
* resolve/rust-ast-resolve-base.h
(ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.cc
(ResolverBase::visit): Likewise.
* checks/errors/rust-feature-gate.h
(FeatureGate::visit): Likewise.
* expand/rust-cfg-strip.cc
(CfgStrip::visit): Likewise.
* expand/rust-cfg-strip.h:
(CfgStrip::visit): Likewise.
* expand/rust-expand-visitor.cc
(ExpandVisitor::visit): Likewise.
* expand/rust-expand-visitor.h
(ExpandVisitor::visit): Likewise.
* hir/rust-ast-lower-base.cc
(ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h:
(ASTLoweringBase::visit): Likewise.
* parse/rust-parse-impl.h
(Parser::parse_if_let_expr): Replace IfLetExprConseqIf{,Let} with IfLetExprConseqElse.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust')
22 files changed, 14 insertions, 356 deletions
diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index 12cbfac..ce934a1 100644 --- a/gcc/rust/ast/rust-ast-dump.cc +++ b/gcc/rust/ast/rust-ast-dump.cc @@ -945,14 +945,6 @@ Dump::visit (IfLetExprConseqElse &) {} void -Dump::visit (IfLetExprConseqIf &) -{} - -void -Dump::visit (IfLetExprConseqIfLet &) -{} - -void Dump::visit (MatchExpr &) {} diff --git a/gcc/rust/ast/rust-ast-dump.h b/gcc/rust/ast/rust-ast-dump.h index a48d4761..b8b5e96 100644 --- a/gcc/rust/ast/rust-ast-dump.h +++ b/gcc/rust/ast/rust-ast-dump.h @@ -186,8 +186,6 @@ private: void visit (IfExprConseqElse &expr); void visit (IfLetExpr &expr); void visit (IfLetExprConseqElse &expr); - void visit (IfLetExprConseqIf &expr); - void visit (IfLetExprConseqIfLet &expr); void visit (MatchExpr &expr); void visit (AwaitExpr &expr); void visit (AsyncBlockExpr &expr); diff --git a/gcc/rust/ast/rust-ast-full-decls.h b/gcc/rust/ast/rust-ast-full-decls.h index 94691f9..bd59c52 100644 --- a/gcc/rust/ast/rust-ast-full-decls.h +++ b/gcc/rust/ast/rust-ast-full-decls.h @@ -137,8 +137,6 @@ class IfExpr; class IfExprConseqElse; class IfLetExpr; class IfLetExprConseqElse; -class IfLetExprConseqIf; -class IfLetExprConseqIfLet; struct MatchArm; // class MatchCase; // class MatchCaseBlockExpr; diff --git a/gcc/rust/ast/rust-ast-tokenstream.cc b/gcc/rust/ast/rust-ast-tokenstream.cc index cdfd870..78b5385 100644 --- a/gcc/rust/ast/rust-ast-tokenstream.cc +++ b/gcc/rust/ast/rust-ast-tokenstream.cc @@ -1449,24 +1449,6 @@ TokenStream::visit (IfLetExprConseqElse &expr) } void -TokenStream::visit (IfLetExprConseqIf &expr) -{ - visit (static_cast<IfLetExpr &> (expr)); - indentation (); - tokens.push_back (Rust::Token::make (ELSE, expr.get_locus ())); - visit (expr.get_conseq_if_expr ()); -} - -void -TokenStream::visit (IfLetExprConseqIfLet &expr) -{ - visit (static_cast<IfLetExpr &> (expr)); - indentation (); - tokens.push_back (Rust::Token::make (ELSE, expr.get_locus ())); - visit (expr.get_conseq_if_let_expr ()); -} - -void TokenStream::visit (MatchArm &arm) { visit_items_as_lines (arm.get_outer_attrs ()); diff --git a/gcc/rust/ast/rust-ast-tokenstream.h b/gcc/rust/ast/rust-ast-tokenstream.h index 83fdece..24be831 100644 --- a/gcc/rust/ast/rust-ast-tokenstream.h +++ b/gcc/rust/ast/rust-ast-tokenstream.h @@ -200,8 +200,6 @@ private: void visit (IfExprConseqElse &expr); void visit (IfLetExpr &expr); void visit (IfLetExprConseqElse &expr); - void visit (IfLetExprConseqIf &expr); - void visit (IfLetExprConseqIfLet &expr); void visit (MatchArm &arm); void visit (MatchCase &arm); void visit (MatchExpr &expr); diff --git a/gcc/rust/ast/rust-ast-visitor.h b/gcc/rust/ast/rust-ast-visitor.h index 621f09e..f11c9c3 100644 --- a/gcc/rust/ast/rust-ast-visitor.h +++ b/gcc/rust/ast/rust-ast-visitor.h @@ -117,8 +117,6 @@ public: virtual void visit (IfExprConseqElse &expr) = 0; virtual void visit (IfLetExpr &expr) = 0; virtual void visit (IfLetExprConseqElse &expr) = 0; - virtual void visit (IfLetExprConseqIf &expr) = 0; - virtual void visit (IfLetExprConseqIfLet &expr) = 0; // virtual void visit(MatchCase& match_case) = 0; // virtual void visit (MatchCaseBlockExpr &match_case) = 0; // virtual void visit (MatchCaseExpr &match_case) = 0; diff --git a/gcc/rust/ast/rust-ast.cc b/gcc/rust/ast/rust-ast.cc index dbbeda3..a664a31 100644 --- a/gcc/rust/ast/rust-ast.cc +++ b/gcc/rust/ast/rust-ast.cc @@ -1673,27 +1673,7 @@ IfLetExprConseqElse::as_string () const { std::string str = IfLetExpr::as_string (); - str += "\n Else block expr: " + else_block->as_string (); - - return str; -} - -std::string -IfLetExprConseqIf::as_string () const -{ - std::string str = IfLetExpr::as_string (); - - str += "\n Else if expr: \n " + if_expr->as_string (); - - return str; -} - -std::string -IfLetExprConseqIfLet::as_string () const -{ - std::string str = IfLetExpr::as_string (); - - str += "\n Else if let expr: \n " + if_let_expr->as_string (); + str += "\n Else expr: " + else_block->as_string (); return str; } @@ -4568,18 +4548,6 @@ IfLetExprConseqElse::accept_vis (ASTVisitor &vis) } void -IfLetExprConseqIf::accept_vis (ASTVisitor &vis) -{ - vis.visit (*this); -} - -void -IfLetExprConseqIfLet::accept_vis (ASTVisitor &vis) -{ - vis.visit (*this); -} - -void MatchExpr::accept_vis (ASTVisitor &vis) { vis.visit (*this); diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index f91d9e9..abe6e03 100644 --- a/gcc/rust/ast/rust-expr.h +++ b/gcc/rust/ast/rust-expr.h @@ -3945,7 +3945,7 @@ protected: * end */ class IfLetExprConseqElse : public IfLetExpr { - std::unique_ptr<BlockExpr> else_block; + std::unique_ptr<ExprWithBlock> else_block; public: std::string as_string () const override; @@ -3953,8 +3953,8 @@ public: IfLetExprConseqElse ( std::vector<std::unique_ptr<Pattern> > match_arm_patterns, std::unique_ptr<Expr> value, std::unique_ptr<BlockExpr> if_block, - std::unique_ptr<BlockExpr> else_block, std::vector<Attribute> outer_attrs, - Location locus) + std::unique_ptr<ExprWithBlock> else_block, + std::vector<Attribute> outer_attrs, Location locus) : IfLetExpr (std::move (match_arm_patterns), std::move (value), std::move (if_block), std::move (outer_attrs), locus), else_block (std::move (else_block)) @@ -3963,7 +3963,7 @@ public: // copy constructor with clone IfLetExprConseqElse (IfLetExprConseqElse const &other) - : IfLetExpr (other), else_block (other.else_block->clone_block_expr ()) + : IfLetExpr (other), else_block (other.else_block->clone_expr_with_block ()) {} // overload assignment operator to clone @@ -3973,7 +3973,7 @@ public: // match_arm_patterns = other.match_arm_patterns; // value = other.value->clone_expr(); // if_block = other.if_block->clone_block_expr(); - else_block = other.else_block->clone_block_expr (); + else_block = other.else_block->clone_expr_with_block (); // outer_attrs = other.outer_attrs; return *this; @@ -3986,7 +3986,7 @@ public: void accept_vis (ASTVisitor &vis) override; // TODO: is this better? Or is a "vis_block" better? - std::unique_ptr<BlockExpr> &get_else_block () + std::unique_ptr<ExprWithBlock> &get_else_block () { rust_assert (else_block != nullptr); return else_block; @@ -4001,124 +4001,6 @@ protected: } }; -/* AST node representing "if let" expression with an "else if" expression at the - * end */ -class IfLetExprConseqIf : public IfLetExpr -{ - std::unique_ptr<IfExpr> if_expr; - -public: - std::string as_string () const override; - - IfLetExprConseqIf (std::vector<std::unique_ptr<Pattern> > match_arm_patterns, - std::unique_ptr<Expr> value, - std::unique_ptr<BlockExpr> if_block, - std::unique_ptr<IfExpr> if_expr, - std::vector<Attribute> outer_attrs, Location locus) - : IfLetExpr (std::move (match_arm_patterns), std::move (value), - std::move (if_block), std::move (outer_attrs), locus), - if_expr (std::move (if_expr)) - {} - // again, outer attributes not allowed - - // copy constructor with clone - IfLetExprConseqIf (IfLetExprConseqIf const &other) - : IfLetExpr (other), if_expr (other.if_expr->clone_if_expr ()) - {} - - // overload assignment operator to clone - IfLetExprConseqIf &operator= (IfLetExprConseqIf const &other) - { - IfLetExpr::operator= (other); - // match_arm_patterns = other.match_arm_patterns; - // value = other.value->clone_expr(); - // if_block = other.if_block->clone_block_expr(); - if_expr = other.if_expr->clone_if_expr (); - - return *this; - } - - // move constructors - IfLetExprConseqIf (IfLetExprConseqIf &&other) = default; - IfLetExprConseqIf &operator= (IfLetExprConseqIf &&other) = default; - - void accept_vis (ASTVisitor &vis) override; - - // TODO: is this better? Or is a "vis_block" better? - std::unique_ptr<IfExpr> &get_conseq_if_expr () - { - rust_assert (if_expr != nullptr); - return if_expr; - } - -protected: - /* Use covariance to implement clone function as returning this object rather - * than base */ - IfLetExprConseqIf *clone_if_let_expr_impl () const override - { - return new IfLetExprConseqIf (*this); - } -}; - -/* AST node representing "if let" expression with an "else if let" expression at - * the end */ -class IfLetExprConseqIfLet : public IfLetExpr -{ - std::unique_ptr<IfLetExpr> if_let_expr; - -public: - std::string as_string () const override; - - IfLetExprConseqIfLet ( - std::vector<std::unique_ptr<Pattern> > match_arm_patterns, - std::unique_ptr<Expr> value, std::unique_ptr<BlockExpr> if_block, - std::unique_ptr<IfLetExpr> if_let_expr, std::vector<Attribute> outer_attrs, - Location locus) - : IfLetExpr (std::move (match_arm_patterns), std::move (value), - std::move (if_block), std::move (outer_attrs), locus), - if_let_expr (std::move (if_let_expr)) - {} - // outer attributes not allowed - - // copy constructor with clone - IfLetExprConseqIfLet (IfLetExprConseqIfLet const &other) - : IfLetExpr (other), if_let_expr (other.if_let_expr->clone_if_let_expr ()) - {} - - // overload assignment operator to clone - IfLetExprConseqIfLet &operator= (IfLetExprConseqIfLet const &other) - { - IfLetExpr::operator= (other); - // match_arm_patterns = other.match_arm_patterns; - // value = other.value->clone_expr(); - // if_block = other.if_block->clone_block_expr(); - if_let_expr = other.if_let_expr->clone_if_let_expr (); - - return *this; - } - - // move constructors - IfLetExprConseqIfLet (IfLetExprConseqIfLet &&other) = default; - IfLetExprConseqIfLet &operator= (IfLetExprConseqIfLet &&other) = default; - - void accept_vis (ASTVisitor &vis) override; - - // TODO: is this better? Or is a "vis_block" better? - std::unique_ptr<IfLetExpr> &get_conseq_if_let_expr () - { - rust_assert (if_let_expr != nullptr); - return if_let_expr; - } - -protected: - /* Use covariance to implement clone function as returning this object rather - * than base */ - IfLetExprConseqIfLet *clone_if_let_expr_impl () const override - { - return new IfLetExprConseqIfLet (*this); - } -}; - // Match arm expression struct MatchArm { diff --git a/gcc/rust/checks/errors/rust-feature-gate.h b/gcc/rust/checks/errors/rust-feature-gate.h index a4e2f90..5d74704 100644 --- a/gcc/rust/checks/errors/rust-feature-gate.h +++ b/gcc/rust/checks/errors/rust-feature-gate.h @@ -97,8 +97,6 @@ public: void visit (AST::IfExprConseqElse &expr) override {} void visit (AST::IfLetExpr &expr) override {} void visit (AST::IfLetExprConseqElse &expr) override {} - void visit (AST::IfLetExprConseqIf &expr) override {} - void visit (AST::IfLetExprConseqIfLet &expr) override {} void visit (AST::MatchExpr &expr) override {} void visit (AST::AwaitExpr &expr) override {} void visit (AST::AsyncBlockExpr &expr) override {} diff --git a/gcc/rust/expand/rust-cfg-strip.cc b/gcc/rust/expand/rust-cfg-strip.cc index 926367a..0aebb6f 100644 --- a/gcc/rust/expand/rust-cfg-strip.cc +++ b/gcc/rust/expand/rust-cfg-strip.cc @@ -1779,93 +1779,6 @@ CfgStrip::visit (AST::IfLetExprConseqElse &expr) "attributes not allowed"); } void -CfgStrip::visit (AST::IfLetExprConseqIf &expr) -{ - // initial strip test based on outer attrs - expand_cfg_attrs (expr.get_outer_attrs ()); - if (fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } - - for (auto &pattern : expr.get_patterns ()) - { - pattern->accept_vis (*this); - if (pattern->is_marked_for_strip ()) - rust_error_at (pattern->get_locus (), - "cannot strip pattern in this position"); - } - - // can't strip value expr itself, but can strip sub-expressions - auto &value_expr = expr.get_value_expr (); - value_expr->accept_vis (*this); - if (value_expr->is_marked_for_strip ()) - rust_error_at (value_expr->get_locus (), - "cannot strip expression in this position - outer " - "attributes not allowed"); - - // can't strip if block itself, but can strip sub-expressions - auto &if_block = expr.get_if_block (); - if_block->accept_vis (*this); - if (if_block->is_marked_for_strip ()) - rust_error_at (if_block->get_locus (), - "cannot strip block expression in this position - outer " - "attributes not allowed"); - - // can't strip if expr itself, but can strip sub-expressions - auto &conseq_if_expr = expr.get_conseq_if_expr (); - conseq_if_expr->accept_vis (*this); - if (conseq_if_expr->is_marked_for_strip ()) - rust_error_at (conseq_if_expr->get_locus (), - "cannot strip consequent if expression in this " - "position - outer attributes not allowed"); -} -void -CfgStrip::visit (AST::IfLetExprConseqIfLet &expr) -{ - // initial strip test based on outer attrs - expand_cfg_attrs (expr.get_outer_attrs ()); - if (fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } - - for (auto &pattern : expr.get_patterns ()) - { - pattern->accept_vis (*this); - if (pattern->is_marked_for_strip ()) - rust_error_at (pattern->get_locus (), - "cannot strip pattern in this position"); - } - - // can't strip value expr itself, but can strip sub-expressions - auto &value_expr = expr.get_value_expr (); - value_expr->accept_vis (*this); - if (value_expr->is_marked_for_strip ()) - rust_error_at (value_expr->get_locus (), - "cannot strip expression in this position - outer " - "attributes not allowed"); - - // can't strip if block itself, but can strip sub-expressions - auto &if_block = expr.get_if_block (); - if_block->accept_vis (*this); - if (if_block->is_marked_for_strip ()) - rust_error_at (if_block->get_locus (), - "cannot strip block expression in this position - outer " - "attributes not allowed"); - - // can't strip if let expr itself, but can strip sub-expressions - auto &conseq_if_let_expr = expr.get_conseq_if_let_expr (); - conseq_if_let_expr->accept_vis (*this); - if (conseq_if_let_expr->is_marked_for_strip ()) - rust_error_at (conseq_if_let_expr->get_locus (), - "cannot strip consequent if let expression in this " - "position - outer attributes not " - "allowed"); -} -void CfgStrip::visit (AST::MatchExpr &expr) { // initial strip test based on outer attrs diff --git a/gcc/rust/expand/rust-cfg-strip.h b/gcc/rust/expand/rust-cfg-strip.h index 41b548b..d631b5a 100644 --- a/gcc/rust/expand/rust-cfg-strip.h +++ b/gcc/rust/expand/rust-cfg-strip.h @@ -133,8 +133,6 @@ public: void visit (AST::IfExprConseqElse &expr) override; void visit (AST::IfLetExpr &expr) override; void visit (AST::IfLetExprConseqElse &expr) override; - void visit (AST::IfLetExprConseqIf &expr) override; - void visit (AST::IfLetExprConseqIfLet &expr) override; void visit (AST::MatchExpr &expr) override; void visit (AST::AwaitExpr &expr) override; void visit (AST::AsyncBlockExpr &expr) override; diff --git a/gcc/rust/expand/rust-expand-visitor.cc b/gcc/rust/expand/rust-expand-visitor.cc index 04013da..c4191ce 100644 --- a/gcc/rust/expand/rust-expand-visitor.cc +++ b/gcc/rust/expand/rust-expand-visitor.cc @@ -700,24 +700,6 @@ ExpandVisitor::visit (AST::IfLetExprConseqElse &expr) } void -ExpandVisitor::visit (AST::IfLetExprConseqIf &expr) -{ - maybe_expand_expr (expr.get_value_expr ()); - - visit (expr.get_if_block ()); - visit (expr.get_conseq_if_expr ()); -} - -void -ExpandVisitor::visit (AST::IfLetExprConseqIfLet &expr) -{ - maybe_expand_expr (expr.get_value_expr ()); - - visit (expr.get_if_block ()); - visit (expr.get_conseq_if_let_expr ()); -} - -void ExpandVisitor::visit (AST::MatchExpr &expr) { visit_outer_attrs (expr); diff --git a/gcc/rust/expand/rust-expand-visitor.h b/gcc/rust/expand/rust-expand-visitor.h index 67c9a55..f312376 100644 --- a/gcc/rust/expand/rust-expand-visitor.h +++ b/gcc/rust/expand/rust-expand-visitor.h @@ -218,8 +218,6 @@ public: void visit (AST::IfExprConseqElse &expr) override; void visit (AST::IfLetExpr &expr) override; void visit (AST::IfLetExprConseqElse &expr) override; - void visit (AST::IfLetExprConseqIf &expr) override; - void visit (AST::IfLetExprConseqIfLet &expr) override; void visit (AST::MatchExpr &expr) override; void visit (AST::AwaitExpr &expr) override; void visit (AST::AsyncBlockExpr &expr) override; diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc index 9c04c21..70f57c3 100644 --- a/gcc/rust/hir/rust-ast-lower-base.cc +++ b/gcc/rust/hir/rust-ast-lower-base.cc @@ -235,12 +235,6 @@ ASTLoweringBase::visit (AST::IfLetExpr &) void ASTLoweringBase::visit (AST::IfLetExprConseqElse &) {} -void -ASTLoweringBase::visit (AST::IfLetExprConseqIf &) -{} -void -ASTLoweringBase::visit (AST::IfLetExprConseqIfLet &) -{} // void ASTLoweringBase::visit(MatchCasematch_case) {} // void ASTLoweringBase:: (AST::MatchCaseBlockExpr &) {} // void ASTLoweringBase:: (AST::MatchCaseExpr &) {} diff --git a/gcc/rust/hir/rust-ast-lower-base.h b/gcc/rust/hir/rust-ast-lower-base.h index 2122779..f839eae 100644 --- a/gcc/rust/hir/rust-ast-lower-base.h +++ b/gcc/rust/hir/rust-ast-lower-base.h @@ -145,8 +145,6 @@ public: virtual void visit (AST::IfExprConseqElse &expr); virtual void visit (AST::IfLetExpr &expr); virtual void visit (AST::IfLetExprConseqElse &expr); - virtual void visit (AST::IfLetExprConseqIf &expr); - virtual void visit (AST::IfLetExprConseqIfLet &expr); // virtual void visit(MatchCase& match_case); // virtual void visit (AST::MatchCaseBlockExpr &match_case); // virtual void visit (AST::MatchCaseExpr &match_case); diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index c48c71f..e636252 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -8219,8 +8219,8 @@ Parser<ManagedTokenSource>::parse_if_let_expr (AST::AttrVec outer_attrs, return nullptr; } - return std::unique_ptr<AST::IfLetExprConseqIfLet> ( - new AST::IfLetExprConseqIfLet ( + return std::unique_ptr<AST::IfLetExprConseqElse> ( + new AST::IfLetExprConseqElse ( std::move (match_arm_patterns), std::move (scrutinee_expr), std::move (if_let_body), std::move (if_let_expr), std::move (outer_attrs), locus)); @@ -8240,12 +8240,11 @@ Parser<ManagedTokenSource>::parse_if_let_expr (AST::AttrVec outer_attrs, return nullptr; } - return std::unique_ptr<AST::IfLetExprConseqIf> ( - new AST::IfLetExprConseqIf (std::move (match_arm_patterns), - std::move (scrutinee_expr), - std::move (if_let_body), - std::move (if_expr), - std::move (outer_attrs), locus)); + return std::unique_ptr<AST::IfLetExprConseqElse> ( + new AST::IfLetExprConseqElse ( + std::move (match_arm_patterns), std::move (scrutinee_expr), + std::move (if_let_body), std::move (if_expr), + std::move (outer_attrs), locus)); } } default: diff --git a/gcc/rust/resolve/rust-ast-resolve-base.cc b/gcc/rust/resolve/rust-ast-resolve-base.cc index 06aeb06..997a153 100644 --- a/gcc/rust/resolve/rust-ast-resolve-base.cc +++ b/gcc/rust/resolve/rust-ast-resolve-base.cc @@ -303,14 +303,6 @@ ResolverBase::visit (AST::IfLetExprConseqElse &) {} void -ResolverBase::visit (AST::IfLetExprConseqIf &) -{} - -void -ResolverBase::visit (AST::IfLetExprConseqIfLet &) -{} - -void ResolverBase::visit (AST::MatchExpr &) {} diff --git a/gcc/rust/resolve/rust-ast-resolve-base.h b/gcc/rust/resolve/rust-ast-resolve-base.h index dc87965..136d637 100644 --- a/gcc/rust/resolve/rust-ast-resolve-base.h +++ b/gcc/rust/resolve/rust-ast-resolve-base.h @@ -97,8 +97,6 @@ public: void visit (AST::IfExprConseqElse &); void visit (AST::IfLetExpr &); void visit (AST::IfLetExprConseqElse &); - void visit (AST::IfLetExprConseqIf &); - void visit (AST::IfLetExprConseqIfLet &); void visit (AST::MatchExpr &); void visit (AST::AwaitExpr &); diff --git a/gcc/rust/resolve/rust-early-name-resolver.cc b/gcc/rust/resolve/rust-early-name-resolver.cc index f06f1bc..6e869d6 100644 --- a/gcc/rust/resolve/rust-early-name-resolver.cc +++ b/gcc/rust/resolve/rust-early-name-resolver.cc @@ -474,22 +474,6 @@ EarlyNameResolver::visit (AST::IfLetExprConseqElse &expr) } void -EarlyNameResolver::visit (AST::IfLetExprConseqIf &expr) -{ - expr.get_value_expr ()->accept_vis (*this); - expr.get_if_block ()->accept_vis (*this); - expr.get_conseq_if_expr ()->accept_vis (*this); -} - -void -EarlyNameResolver::visit (AST::IfLetExprConseqIfLet &expr) -{ - expr.get_value_expr ()->accept_vis (*this); - expr.get_if_block ()->accept_vis (*this); - expr.get_conseq_if_let_expr ()->accept_vis (*this); -} - -void EarlyNameResolver::visit (AST::MatchExpr &expr) { expr.get_scrutinee_expr ()->accept_vis (*this); diff --git a/gcc/rust/resolve/rust-early-name-resolver.h b/gcc/rust/resolve/rust-early-name-resolver.h index c6f8004..0728137 100644 --- a/gcc/rust/resolve/rust-early-name-resolver.h +++ b/gcc/rust/resolve/rust-early-name-resolver.h @@ -179,8 +179,6 @@ private: virtual void visit (AST::IfExprConseqElse &expr); virtual void visit (AST::IfLetExpr &expr); virtual void visit (AST::IfLetExprConseqElse &expr); - virtual void visit (AST::IfLetExprConseqIf &expr); - virtual void visit (AST::IfLetExprConseqIfLet &expr); virtual void visit (AST::MatchExpr &expr); virtual void visit (AST::AwaitExpr &expr); virtual void visit (AST::AsyncBlockExpr &expr); diff --git a/gcc/rust/util/rust-attributes.cc b/gcc/rust/util/rust-attributes.cc index 4281f298..03afad7 100644 --- a/gcc/rust/util/rust-attributes.cc +++ b/gcc/rust/util/rust-attributes.cc @@ -477,14 +477,6 @@ AttributeChecker::visit (AST::IfLetExprConseqElse &) {} void -AttributeChecker::visit (AST::IfLetExprConseqIf &) -{} - -void -AttributeChecker::visit (AST::IfLetExprConseqIfLet &) -{} - -void AttributeChecker::visit (AST::MatchExpr &) {} diff --git a/gcc/rust/util/rust-attributes.h b/gcc/rust/util/rust-attributes.h index 1c642cd..e8a1d27 100644 --- a/gcc/rust/util/rust-attributes.h +++ b/gcc/rust/util/rust-attributes.h @@ -162,8 +162,6 @@ private: void visit (AST::IfExprConseqElse &expr); void visit (AST::IfLetExpr &expr); void visit (AST::IfLetExprConseqElse &expr); - void visit (AST::IfLetExprConseqIf &expr); - void visit (AST::IfLetExprConseqIfLet &expr); void visit (AST::MatchExpr &expr); void visit (AST::AwaitExpr &expr); void visit (AST::AsyncBlockExpr &expr); |