Skip to content

Parse try expressions #3870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2025
Merged

Parse try expressions #3870

merged 1 commit into from
Jul 7, 2025

Conversation

powerboat9
Copy link
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 <[email protected]>
Copy link
Member

@CohenArthur CohenArthur left a comment

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