public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Unify AST::IfLetExprConseqIf{, Let} into AST::IfLetExprConseqElse
@ 2023-04-18 16:45 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-04-18 16:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2608859a394d28ddf6dc0f31954e252c7a562318

commit 2608859a394d28ddf6dc0f31954e252c7a562318
Author: Owen Avery <powerboat9.gamer@gmail.com>
Date:   Wed Mar 15 23:30:19 2023 -0400

    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>

Diff:
---
 gcc/rust/ast/rust-ast-dump.cc                |   8 --
 gcc/rust/ast/rust-ast-dump.h                 |   2 -
 gcc/rust/ast/rust-ast-full-decls.h           |   2 -
 gcc/rust/ast/rust-ast-tokenstream.cc         |  18 ----
 gcc/rust/ast/rust-ast-tokenstream.h          |   2 -
 gcc/rust/ast/rust-ast-visitor.h              |   2 -
 gcc/rust/ast/rust-ast.cc                     |  34 +------
 gcc/rust/ast/rust-expr.h                     | 130 ++-------------------------
 gcc/rust/checks/errors/rust-feature-gate.h   |   2 -
 gcc/rust/expand/rust-cfg-strip.cc            |  87 ------------------
 gcc/rust/expand/rust-cfg-strip.h             |   2 -
 gcc/rust/expand/rust-expand-visitor.cc       |  18 ----
 gcc/rust/expand/rust-expand-visitor.h        |   2 -
 gcc/rust/hir/rust-ast-lower-base.cc          |   6 --
 gcc/rust/hir/rust-ast-lower-base.h           |   2 -
 gcc/rust/parse/rust-parse-impl.h             |  15 ++--
 gcc/rust/resolve/rust-ast-resolve-base.cc    |   8 --
 gcc/rust/resolve/rust-ast-resolve-base.h     |   2 -
 gcc/rust/resolve/rust-early-name-resolver.cc |  16 ----
 gcc/rust/resolve/rust-early-name-resolver.h  |   2 -
 gcc/rust/util/rust-attributes.cc             |   8 --
 gcc/rust/util/rust-attributes.h              |   2 -
 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 4bc6b9d0fbe..34cc4b01065 100644
--- a/gcc/rust/ast/rust-ast-dump.cc
+++ b/gcc/rust/ast/rust-ast-dump.cc
@@ -944,14 +944,6 @@ void
 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 cfde57d0e2e..1bfa8082278 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 ebfb17b7f7a..23da27eb214 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 cdfd8701c6d..78b53852658 100644
--- a/gcc/rust/ast/rust-ast-tokenstream.cc
+++ b/gcc/rust/ast/rust-ast-tokenstream.cc
@@ -1448,24 +1448,6 @@ TokenStream::visit (IfLetExprConseqElse &expr)
   visit (expr.get_else_block ());
 }
 
-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)
 {
diff --git a/gcc/rust/ast/rust-ast-tokenstream.h b/gcc/rust/ast/rust-ast-tokenstream.h
index 83fdece7052..24be831009a 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 4c8a7456f54..6cdb0278aed 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 5f9ca485008..754d5f30299 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;
 }
@@ -4567,18 +4547,6 @@ IfLetExprConseqElse::accept_vis (ASTVisitor &vis)
   vis.visit (*this);
 }
 
-void
-IfLetExprConseqIf::accept_vis (ASTVisitor &vis)
-{
-  vis.visit (*this);
-}
-
-void
-IfLetExprConseqIfLet::accept_vis (ASTVisitor &vis)
-{
-  vis.visit (*this);
-}
-
 void
 MatchExpr::accept_vis (ASTVisitor &vis)
 {
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index f91d9e9ceb2..abe6e03ce45 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 5571df91b78..e17e6ea06cd 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 9c6c249bb89..ece52991378 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 ff71c6ef3a5..14d933b43a8 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 04013da8fff..c4191ce68d1 100644
--- a/gcc/rust/expand/rust-expand-visitor.cc
+++ b/gcc/rust/expand/rust-expand-visitor.cc
@@ -699,24 +699,6 @@ ExpandVisitor::visit (AST::IfLetExprConseqElse &expr)
   visit (expr.get_else_block ());
 }
 
-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)
 {
diff --git a/gcc/rust/expand/rust-expand-visitor.h b/gcc/rust/expand/rust-expand-visitor.h
index 67c9a5558b6..f3123767213 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 fe751ef2e26..1be58ad9bd2 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 cee2e7b89f8..38384d87c1e 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 d7eebc25ecf..38f68ba75b2 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 928e5caad6c..55883e9fe7d 100644
--- a/gcc/rust/resolve/rust-ast-resolve-base.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-base.cc
@@ -302,14 +302,6 @@ void
 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 54f423240d9..20e3be11386 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 b1f10d8c0e7..d32f2dcdbba 100644
--- a/gcc/rust/resolve/rust-early-name-resolver.cc
+++ b/gcc/rust/resolve/rust-early-name-resolver.cc
@@ -473,22 +473,6 @@ EarlyNameResolver::visit (AST::IfLetExprConseqElse &expr)
   expr.get_else_block ()->accept_vis (*this);
 }
 
-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)
 {
diff --git a/gcc/rust/resolve/rust-early-name-resolver.h b/gcc/rust/resolve/rust-early-name-resolver.h
index 7bedbaa647d..97b2a111f9e 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 2d99974c17f..bba4d128f3c 100644
--- a/gcc/rust/util/rust-attributes.cc
+++ b/gcc/rust/util/rust-attributes.cc
@@ -476,14 +476,6 @@ void
 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 8903c93923e..58f03111c7c 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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-18 16:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 16:45 [gcc/devel/rust/master] Unify AST::IfLetExprConseqIf{, Let} into AST::IfLetExprConseqElse Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).