Skip to content

Unify AST::IfExprConseqIf{,Let} into AST::IfExprConseqElse#2001

Merged
CohenArthur merged 1 commit into
Rust-GCC:masterfrom
powerboat9:ast-if-expr
Apr 12, 2023
Merged

Unify AST::IfExprConseqIf{,Let} into AST::IfExprConseqElse#2001
CohenArthur merged 1 commit into
Rust-GCC:masterfrom
powerboat9:ast-if-expr

Conversation

@powerboat9

@powerboat9 powerboat9 commented Mar 17, 2023

Copy link
Copy Markdown
Collaborator

Code cleanup related to if let lowering.

@powerboat9 powerboat9 force-pushed the ast-if-expr branch 2 times, most recently from 1169690 to 2bbc2ec Compare March 20, 2023 12:34
@philberty philberty self-requested a review March 20, 2023 21:07

@CohenArthur CohenArthur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit more explanation in the commit message or in the PR's body would be nice for these huge refactors, as it's a bit hard to figure out what their purpose is otherwise. Also, you can put "Likewise." in your Changelog entries if you are going to use the same description as the line above - but this is a convention, not an obligation. Nonetheless, good work and good cleanup :) Thank you!

@CohenArthur

Copy link
Copy Markdown
Member

And again once conflicts are resolved I'm okay with merging this

@powerboat9 powerboat9 force-pushed the ast-if-expr branch 4 times, most recently from cfeab7d to da962ca Compare March 31, 2023 15:19
@powerboat9

Copy link
Copy Markdown
Collaborator Author

Conflicts are now resolved

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>
@CohenArthur CohenArthur enabled auto-merge April 12, 2023 12:43
@CohenArthur CohenArthur added this pull request to the merge queue Apr 12, 2023
Merged via the queue into Rust-GCC:master with commit 132a501 Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants