diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2023-03-15 23:05:07 -0400 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-04-12 13:17:19 +0000 |
commit | 132a5011e384994e6121eb606f2442ca61fbe908 (patch) | |
tree | fb9da31637abdbcf97037be6611abc206710a548 /gcc/rust/resolve | |
parent | dc5f674759ecea1531e857e35ebccc1d302be7d4 (diff) | |
download | gcc-132a5011e384994e6121eb606f2442ca61fbe908.zip gcc-132a5011e384994e6121eb606f2442ca61fbe908.tar.gz gcc-132a5011e384994e6121eb606f2442ca61fbe908.tar.bz2 |
Unify AST::IfExprConseqIf{,Let} into AST::IfExprConseqElse
This simplifies the AST's representation of if-statements
to match the HIR.
gcc/rust/ChangeLog:
* ast/rust-expr.h
(class IfExprConseqElse): Make else_block ExprWithBlock.
(class IfExprConseqIf): Remove.
(class IfExprConseqIfLet): Remove.
* ast/rust-ast-full-decls.h
(class IfExprConseqIf): Remove.
(class IfExprConseqIfLet): Remove.
* ast/rust-ast.cc
(IfExprConseqElse::as_string): Adjust output.
(IfExprConseqIf::as_string): Remove.
(IfExprConseqIfLet::as_string): Remove.
(IfExprConseqIf::accept_vis): Remove.
(IfExprConseqIfLet::accept_vis): Remove.
* ast/rust-ast-visitor.h
(ASTVisitor::visit): Remove IfExprConseqIf{,Let} visitors.
* ast/rust-ast-tokenstream.cc
(TokenStream::visit): Likewise.
* ast/rust-ast-tokenstream.h
(TokenStream::visit): Likewise.
* ast/rust-ast-dump.cc
(Dump::visit): Likewise.
* ast/rust-ast-dump.h
(Dump::visit): Likewise.
* checks/errors/rust-feature-gate.h
(FeatureGate::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.
* resolve/rust-ast-resolve-expr.h
(ResolveExpr::visit): Remove IfExprConseqIf visitor.
* resolve/rust-ast-resolve-expr.cc
(ResolveExpr::visit): Likewise.
* expand/rust-cfg-strip.cc
(CfgStrip::visit): Remove IfExprConseqIf{,Let} visitors.
* 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.
* hir/rust-ast-lower-block.h
(ASTLoweringIfBlock::visit): Remove IfExprConseqIf visitor.
(ASTLoweringExprWithBlock::visit): Likewise.
* hir/rust-ast-lower.cc
(ASTLoweringIfBlock::visit):
Remove IfExprConseqIf visitor, adjust IfExprConseqElse lowering.
* hir/rust-ast-lower-expr.h
(ASTLoweringExpr::visit): Remove IfExprConseqIf visitor.
* hir/rust-ast-lower-expr.cc
(ASTLoweringExpr::visit): Likewise.
* parse/rust-parse-impl.h
(Parser::parse_if_expr): Replace IfExprConseqIf{,Let} with IfExprConseqElse.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-base.cc | 8 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-base.h | 2 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-expr.cc | 8 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-expr.h | 1 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-early-name-resolver.cc | 16 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-early-name-resolver.h | 2 |
6 files changed, 0 insertions, 37 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-base.cc b/gcc/rust/resolve/rust-ast-resolve-base.cc index 2667a24..928e5ca 100644 --- a/gcc/rust/resolve/rust-ast-resolve-base.cc +++ b/gcc/rust/resolve/rust-ast-resolve-base.cc @@ -295,14 +295,6 @@ ResolverBase::visit (AST::IfExprConseqElse &) {} void -ResolverBase::visit (AST::IfExprConseqIf &) -{} - -void -ResolverBase::visit (AST::IfExprConseqIfLet &) -{} - -void ResolverBase::visit (AST::IfLetExpr &) {} diff --git a/gcc/rust/resolve/rust-ast-resolve-base.h b/gcc/rust/resolve/rust-ast-resolve-base.h index df70303..54f4232 100644 --- a/gcc/rust/resolve/rust-ast-resolve-base.h +++ b/gcc/rust/resolve/rust-ast-resolve-base.h @@ -95,8 +95,6 @@ public: void visit (AST::ForLoopExpr &); void visit (AST::IfExpr &); void visit (AST::IfExprConseqElse &); - void visit (AST::IfExprConseqIf &); - void visit (AST::IfExprConseqIfLet &); void visit (AST::IfLetExpr &); void visit (AST::IfLetExprConseqElse &); void visit (AST::IfLetExprConseqIf &); diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.cc b/gcc/rust/resolve/rust-ast-resolve-expr.cc index a6b16f3..ba9620c 100644 --- a/gcc/rust/resolve/rust-ast-resolve-expr.cc +++ b/gcc/rust/resolve/rust-ast-resolve-expr.cc @@ -187,14 +187,6 @@ ResolveExpr::visit (AST::IfExprConseqElse &expr) } void -ResolveExpr::visit (AST::IfExprConseqIf &expr) -{ - ResolveExpr::go (expr.get_condition_expr ().get (), prefix, canonical_prefix); - ResolveExpr::go (expr.get_if_block ().get (), prefix, canonical_prefix); - ResolveExpr::go (expr.get_conseq_if_expr ().get (), prefix, canonical_prefix); -} - -void ResolveExpr::visit (AST::IfLetExpr &expr) { ResolveExpr::go (expr.get_value_expr ().get (), prefix, canonical_prefix); diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.h b/gcc/rust/resolve/rust-ast-resolve-expr.h index 9863588..5294b98 100644 --- a/gcc/rust/resolve/rust-ast-resolve-expr.h +++ b/gcc/rust/resolve/rust-ast-resolve-expr.h @@ -50,7 +50,6 @@ public: void visit (AST::TypeCastExpr &expr) override; void visit (AST::IfExpr &expr) override; void visit (AST::IfExprConseqElse &expr) override; - void visit (AST::IfExprConseqIf &expr) override; void visit (AST::IfLetExpr &expr) override; void visit (AST::BlockExpr &expr) override; void visit (AST::UnsafeBlockExpr &expr) override; diff --git a/gcc/rust/resolve/rust-early-name-resolver.cc b/gcc/rust/resolve/rust-early-name-resolver.cc index b3fb5a8..b1f10d8 100644 --- a/gcc/rust/resolve/rust-early-name-resolver.cc +++ b/gcc/rust/resolve/rust-early-name-resolver.cc @@ -457,22 +457,6 @@ EarlyNameResolver::visit (AST::IfExprConseqElse &expr) } void -EarlyNameResolver::visit (AST::IfExprConseqIf &expr) -{ - expr.get_condition_expr ()->accept_vis (*this); - expr.get_if_block ()->accept_vis (*this); - expr.get_conseq_if_expr ()->accept_vis (*this); -} - -void -EarlyNameResolver::visit (AST::IfExprConseqIfLet &expr) -{ - expr.get_condition_expr ()->accept_vis (*this); - expr.get_if_block ()->accept_vis (*this); - expr.get_conseq_if_let_expr ()->accept_vis (*this); -} - -void EarlyNameResolver::visit (AST::IfLetExpr &expr) { expr.get_value_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 c94a775..7bedbaa 100644 --- a/gcc/rust/resolve/rust-early-name-resolver.h +++ b/gcc/rust/resolve/rust-early-name-resolver.h @@ -177,8 +177,6 @@ private: virtual void visit (AST::ForLoopExpr &expr); virtual void visit (AST::IfExpr &expr); virtual void visit (AST::IfExprConseqElse &expr); - virtual void visit (AST::IfExprConseqIf &expr); - virtual void visit (AST::IfExprConseqIfLet &expr); virtual void visit (AST::IfLetExpr &expr); virtual void visit (AST::IfLetExprConseqElse &expr); virtual void visit (AST::IfLetExprConseqIf &expr); |