Skip to content
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

ast: Add new Kind enums for more precise downcasting #3320

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

CohenArthur
Copy link
Member

This commit adds things like Item::Kind, Expr::Kind, etc, and implements the associated get_*_kind functions. It also removes the more generic AST::Kind enum we were using, which was incomplete and painful to use.

@CohenArthur CohenArthur force-pushed the more-static-downcast branch 2 times, most recently from 45696f1 to bb48ede Compare December 22, 2024 18:03
This commit adds things like Item::Kind, Expr::Kind, etc, and implements the associated `get_*_kind` functions.
It also removes the more generic AST::Kind enum we were using, which was incomplete and painful to use.

gcc/rust/ChangeLog:

	* ast/rust-ast.h: Add new Kind enums, remove Node class.
	* ast/rust-builtin-ast-nodes.h: Use new Kind enums.
	* ast/rust-expr.h (class LoopLabel): Likewise.
	* ast/rust-item.h: Likewise.
	* ast/rust-macro.h: Likewise.
	* ast/rust-path.h: Likewise.
	* expand/rust-macro-builtins-helpers.cc: Likewise.
	* expand/rust-macro-builtins-utility.cc (MacroBuiltin::concat_handler): Likewise.
	(MacroBuiltin::stringify_handler): Likewise.
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Likewise.
	* resolve/rust-early-name-resolver.cc: Likewise.
	* hir/rust-ast-lower.cc (ASTLoweringBlock::visit): Likewise.
@CohenArthur CohenArthur added this pull request to the merge queue Jan 6, 2025
Merged via the queue into Rust-GCC:master with commit 26d3103 Jan 6, 2025
12 checks passed
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.

1 participant