-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Remove dead code from AstNode
trait
#15479
base: main
Are you sure you want to change the base?
Conversation
|
They're mainly experimentations on my end but I never really had time to fully persuade them. The overall design with I do think it might be valuable to keep
|
What I'm eventually aiming for (WIP branch here) would be to use |
While looking into potential AST optimizations, I noticed that there were several methods in the
AstNode
trait that aren't used anywhere in Ruff or Red Knot. It looks like they might be historical artifacts of previous ways of consuming AST nodes?cast
,cast_ref
, andcan_cast
are not used anywhere.cast_ref
isn't needed anymore, theRef
associated type andStatementRef
andTypeParamRef
types aren't either.visit_source_order
out of the trait, since it was never used through adyn
reference anyway.I had also considered inlining
visit_source_order
directly into its call sites, but it's used both in thewalk_foo
functions and withinAnyNodeRef::visit_preorder
, so I kept them factored out into separate methods.This is a pure refactoring, with no intended behavior changes.