Skip to content

Parse try expressions#3870

Merged
CohenArthur merged 1 commit into
Rust-GCC:masterfrom
powerboat9:parse-try
Jul 7, 2025
Merged

Parse try expressions#3870
CohenArthur merged 1 commit into
Rust-GCC:masterfrom
powerboat9:parse-try

Conversation

@powerboat9

Copy link
Copy Markdown
Collaborator

This doesn't do anything beyond creating TryExpr and parsing them, so try expressions shouldn't be able to make it past AST lowering yet.

This doesn't do anything beyond creating TryExpr and parsing them, so
try expressions shouldn't be able to make it past AST lowering yet.

gcc/rust/ChangeLog:

	* ast/rust-ast-collector.cc (TokenCollector::visit): Add visitor
	for TryExpr.
	* ast/rust-ast-collector.h (TokenCollector::visit): Likewise.
	* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
	* ast/rust-ast-visitor.h (ASTVisitor::visit): Likewise.
	(DefaultASTVisitor::visit): Likewise.
	* expand/rust-derive.h (DeriveVisitor::visit): Likewise.
	* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
	* hir/rust-ast-lower-base.h (ASTLoweringBase::visit): Likewise.
	* resolve/rust-ast-resolve-base.cc (ResolverBase::visit):
	Likewise.
	* resolve/rust-ast-resolve-base.h (ResolverBase::visit):
	Likewise.
	* ast/rust-ast-full-decls.h (class TryExpr): New forward class
	declaration.
	* ast/rust-ast.cc (TryExpr::as_string): New function.
	(TryExpr::accept_vis): Likewise.
	* ast/rust-expr.h (class TryExpr): New class.
	* parse/rust-parse.h (Parser::parse_try_expr): New function.
	* parse/rust-parse-impl.h (Parser::parse_try_expr): Likewise.
	(Parser::null_denotation_not_path): Use parse_try_expr to parse
	try expressions.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>

@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.

LGTM! thanks!!

@CohenArthur CohenArthur added this pull request to the merge queue Jul 7, 2025
Merged via the queue into Rust-GCC:master with commit 508b195 Jul 7, 2025
13 checks passed
@powerboat9 powerboat9 deleted the parse-try branch July 7, 2025 14:12
@CohenArthur CohenArthur added this to the try blocks milestone Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants