Remove customizable reference enum names (#15647)

The AST generator creates a reference enum for each syntax group — an
enum where each variant contains a reference to the relevant syntax
node. Previously you could customize the name of the reference enum for
a group — primarily because there was an existing `ExpressionRef` type
that wouldn't have lined up with the auto-derived name `ExprRef`. This
follow-up PR is a simple search/replace to switch over to the
auto-derived name, so that we can remove this customization point.
This commit is contained in:
Douglas Creager 2025-01-21 13:46:31 -05:00 committed by GitHub
parent fa546b20a6
commit ef85c682bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 223 additions and 231 deletions

View file

@ -1,7 +1,7 @@
use ruff_db::files::{File, FilePath};
use ruff_db::source::line_index;
use ruff_python_ast as ast;
use ruff_python_ast::{Expr, ExpressionRef};
use ruff_python_ast::{Expr, ExprRef};
use ruff_source_file::LineIndex;
use crate::module_name::ModuleName;
@ -48,7 +48,7 @@ pub trait HasTy {
fn ty<'db>(&self, model: &SemanticModel<'db>) -> Type<'db>;
}
impl HasTy for ast::ExpressionRef<'_> {
impl HasTy for ast::ExprRef<'_> {
fn ty<'db>(&self, model: &SemanticModel<'db>) -> Type<'db> {
let index = semantic_index(model.db, model.file);
let file_scope = index.expression_scope_id(*self);
@ -64,7 +64,7 @@ macro_rules! impl_expression_has_ty {
impl HasTy for $ty {
#[inline]
fn ty<'db>(&self, model: &SemanticModel<'db>) -> Type<'db> {
let expression_ref = ExpressionRef::from(self);
let expression_ref = ExprRef::from(self);
expression_ref.ty(model)
}
}